Ejemplo n.º 1
0
        public IHttpActionResult Put(ChefEdit chef)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!chefService.UpdateChef(chef))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Ejemplo n.º 2
0
        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);
        }