public IHttpActionResult EditUser(int id, [FromBody] EditUserVM updatedUser) { var user = bllModel.GetUserById(id); if (user == null) { return(NotFound()); } if (!string.IsNullOrWhiteSpace(updatedUser.Name)) { user.Name = updatedUser.Name; } if (updatedUser.BirthDate != new DateTime()) { user.BirthDate = updatedUser.BirthDate; } if (bllModel.UpdateUser(user)) { return(Ok()); } return(BadRequest("We can't update user with this parametrs")); }
public ActionResult Edit(int id) { var user = bllModel.GetUserById(id); if (user == null) { return(HttpNotFound()); } var userModel = Mapper.Map <EditUserVM>(user); return(View(userModel)); }