public IHttpActionResult UpdateParent(int id, Parent parent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Parent updatedParent = parentsService.UpdateParent(id, parent); if (updatedParent == null) { return(NotFound()); } return(Ok(updatedParent)); }
public IHttpActionResult UpdateParent(string id, Parent parent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Parent updatedParent = parentsService.UpdateParent(id, parent); if (updatedParent == null) { return(NotFound()); } logger.Info("Updating parent"); return(Ok(updatedParent)); }
public IHttpActionResult PutParent([FromUri] Guid id, [FromBody] UserDto parent) { if (ModelState.IsValid != true) { return(BadRequest(ModelState)); } ParentDto parentDto = new ParentDto(); try { parentDto = db.GetParent(id); } catch (NullReferenceException e) { logger.Error(e.Message); return(NotFound()); } return(Ok(db.UpdateParent(id, parent.FirstName, parent.LastName, parent.UserName, parent.Email, parent.Password))); }