public async Task <ActionResult <OrderCooking> > PostOrderCooking(OrderCooking orderCooking) { _context.OrderCooking.Add(orderCooking); await _context.SaveChangesAsync(); return(CreatedAtAction("GetOrderCooking", new { id = orderCooking.Id }, orderCooking)); }
public async Task <IActionResult> PutOrderCooking(int id, OrderCooking orderCooking) { if (id != orderCooking.Id) { return(BadRequest()); } _context.Entry(orderCooking).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderCookingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void InsertOrUpdate(OrderCooking ordercooking) { if (ordercooking.Id == default(System.Guid)) { // New entity ordercooking.Id = Guid.NewGuid(); context.OrderCookings.Add(ordercooking); } else { // Existing entity context.Entry(ordercooking).State = EntityState.Modified; } }
public ActionResult Create(OrderCooking ordercooking) { if (ModelState.IsValid) { ordercookingRepository.InsertOrUpdate(ordercooking); ordercookingRepository.Save(); return RedirectToAction("Index"); } else { ViewBag.PossibleWaiters = waiterRepository.All; ViewBag.PossibleRestaurants = restaurantRepository.All; return View(); } }
public void InsertOrUpdate(OrderCooking ordercooking) { if (ordercooking.Id == default(System.Guid)) { // New entity ordercooking.Id = Guid.NewGuid(); context.OrderCookings.Add(ordercooking); } else { // Existing entity context.Entry(ordercooking).State = EntityState.Modified; } }
public ActionResult Edit(OrderCooking ordercooking) { if (ModelState.IsValid) { ordercookingRepository.InsertOrUpdate(ordercooking); ordercookingRepository.Save(); return(RedirectToAction("Index")); } else { ViewBag.PossibleWaiters = waiterRepository.All; ViewBag.PossibleRestaurants = restaurantRepository.All; return(View()); } }