public IHttpActionResult Put(Employee employee) { //if (ModelState.IsValid) //{ // employeeObjBs.Update(employee); // return Ok(employee); //} //else // return BadRequest(ModelState); if (ModelState.IsValid) { if (employeeObjBs.Update(employee)) { return(Ok(employee)); } else { foreach (var error in employeeObjBs.Errors) { ModelState.AddModelError("", error); } return(BadRequest(ModelState)); } } else { return(BadRequest(ModelState)); } }
public IHttpActionResult Put(Employee employee) { if (!(ModelState.IsValid && _employeeObjBs.Update(employee))) { return(SendBadRequest()); } return(Ok(employee)); }