public IHttpActionResult Put(int id, [FromBody] FoodandBeverage value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var existing = ManagerBuilder.FoodandBeverageManager.GetById(id); if (existing == null) { return(NotFound()); } ManagerBuilder.FoodandBeverageManager.Update(value); DataController.DbSave(); return(Ok(value)); }
public IHttpActionResult Post([FromBody] FoodandBeverage value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var FoodandBeverage = ManagerBuilder.FoodandBeverageManager.Exists(value); if (FoodandBeverage) { ManagerBuilder.FoodandBeverageManager.Update(value); } else { ManagerBuilder.FoodandBeverageManager.Add(value); } DataController.DbSave(); return(Ok(value)); }