public async Task <IActionResult> PutFoodItem(int id, FoodItem foodItem) { if (id != foodItem.FoodItemId) { return(BadRequest()); } _context.Entry(foodItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FoodItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutOrderMaster(long id, OrderMaster orderMaster) { if (id != orderMaster.OrderMasterId) { return(BadRequest()); } _context.Entry(orderMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCustomer(int id, Customer customer) { if (id != customer.CustomerId) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IHttpActionResult> PostResturant(Resturant resturant) { if (ModelState.IsValid && resturant != null) { _context.Resturants.Add(resturant); await _context.SaveChangesAsync(); return(Ok()); } return(BadRequest(ModelState)); }