public async Task <IActionResult> PutOrderLine(int id, OrderLine orderLine) { if (id != orderLine.Id) { return(BadRequest()); } _context.Entry(orderLine).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderLineExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCustomer(int id, Customer customer) { if (id != customer.Id) { 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 <IActionResult> PutSales(int id, Sales sales) { if (id != sales.Id) { return(BadRequest()); } _context.Entry(sales).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "SupplierId,Name,Address,State")] Supplier supplier) { if (ModelState.IsValid) { db.Entry(supplier).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(supplier)); }
public ActionResult Edit([Bind(Include = "ProductId,Name,QtyStock,DateOfPurchase")] Product product) { ViewBag.SupplierNames = db.Suppliers.Select(x => x.Name).ToList(); if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult Edit(Report report) { if (ModelState.IsValid) { using (var ctx = new SalesDbContext()) { ctx.Entry(report).State = EntityState.Modified; ctx.SaveChanges(); return(RedirectToAction("Index")); } } return(View(report)); }