예제 #1
0
        public bool CreateChef(ChefCreate model)
        {
            var entity =
                new Chef()
            {
                Full_Name  = model.Full_Name,
                Speciality = model.Speciality,
            };

            _context.Chefs.Add(entity);
            return(_context.SaveChanges() == 1);
        }
예제 #2
0
        public IHttpActionResult Post(ChefCreate Chef)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!chefService.CreateChef(Chef))
            {
                return(InternalServerError());
            }

            return(Ok());
        }