public IHttpActionResult Put(ChefEdit chef) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!chefService.UpdateChef(chef)) { return(InternalServerError()); } return(Ok()); }
public bool UpdateChef(ChefEdit model) { var chefEntity = _context.Chefs.Find(model.ChefID); if (chefEntity == null) { return(false); } chefEntity.ChefID = model.ChefID; chefEntity.Full_Name = model.Full_Name; chefEntity.Speciality = model.Speciality; return(_context.SaveChanges() == 1); }