Get 方法中的多个参数
Multiple parameter in Get Method
[Route("api/LoginValues/itemcode/{username}/{password}")]
[HttpGet]
public IEnumerable<AC_Attendance> Get(string username, string password )
{
**var list = from g in db.AC_Attendances where g.username == username select g;**
return list;
}
我想怎么做“g.username == 用户名和 g.password== 密码”
public IEnumerable<AC_Attendance> Get(string username, string password)
{
var a = db.AC_Attendances
.Where(s => s.username == username && s.password == password)
.ToArray();
if (a != null)
{
return a;
}
else
{
return null;
}
}
例如我将employee(userID和password)作为参数。
public IEnumerable<Employee> Get(int Id, string password)
{
using (EmployeeDBEntities entities = new EmployeeDBEntities())
{
return entities.Employees.Where(tem => tem.ID == Id && tem.password
== password).ToList();
}
}
[Route("api/LoginValues/itemcode/{username}/{password}")]
[HttpGet]
public IEnumerable<AC_Attendance> Get(string username, string password )
{
**var list = from g in db.AC_Attendances where g.username == username select g;**
return list;
}
我想怎么做“g.username == 用户名和 g.password== 密码”
public IEnumerable<AC_Attendance> Get(string username, string password)
{
var a = db.AC_Attendances
.Where(s => s.username == username && s.password == password)
.ToArray();
if (a != null)
{
return a;
}
else
{
return null;
}
}
例如我将employee(userID和password)作为参数。
public IEnumerable<Employee> Get(int Id, string password)
{
using (EmployeeDBEntities entities = new EmployeeDBEntities())
{
return entities.Employees.Where(tem => tem.ID == Id && tem.password
== password).ToList();
}
}