public IHttpActionResult Post(Employee emp) { if (employeeObjBs.GetByEmail(ref emp)) { return(Ok(emp)); } else { foreach (var error in employeeObjBs.Errors) { ModelState.AddModelError("", error); } return(BadRequest(ModelState)); } }
public IHttpActionResult Post(Employee emp) { Employee employee = employeeObjBs.GetByEmail(emp.Email); if (employee == null) { ModelState.AddModelError("", "Email id Does not Exist"); return(BadRequest(ModelState)); } else if (employee.Password != emp.Password) { ModelState.AddModelError("", "Invalid Password"); return(BadRequest(ModelState)); } else { return(Ok(employee)); } }