asp.net-web-api2webapigetmethod

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;
    }

enter image description here

How i want to make " g.username == username AND g.password== password "


Solution

  • For example I have taken employee(userID and password) as parameter.

    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();
           }
       }