public async Task <IActionResult> PutVendor(int id, Vendor vendor) { if (id != vendor.Id) { return(BadRequest()); } _context.Entry(vendor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutInvoice(int id, Invoice invoice) { if (id != invoice.Id) { return(BadRequest()); } _context.Entry(invoice).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InvoiceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAddress(int id, Address address) { if (id != address.Id) { return(BadRequest()); } _context.Entry(address).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddressExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Name,Address,Tel,Creditlimit")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "ID,Name,Active")] Item item) { if (ModelState.IsValid) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(item)); }
public ActionResult Edit([Bind(Include = "ID,InvoiceDate,ItemTotal,Discount,Tax,InvoiceTotal,CustomerID")] Invoice invoice) { if (ModelState.IsValid) { db.Entry(invoice).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CustomerID = new SelectList(db.Customer, "ID", "Name", invoice.CustomerID); return View(invoice); }
public ActionResult Edit([Bind(Include = "Id,Name,Address,Email,WebAddress,Phone,FinancialYearId")] Shop shop) { if (ModelState.IsValid) { db.Entry(shop).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FinancialYearId = new SelectList(db.FinancialYears, "Id", "Name", shop.FinancialYearId); return(View(shop)); }
public ActionResult Edit([Bind(Include = "ID,EffectiveDate,UnitPrice,Active,ItemID")] ItemDetail itemDetail) { if (ModelState.IsValid) { db.Entry(itemDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ItemID = new SelectList(db.Item, "ID", "Name", itemDetail.ItemID); return(View(itemDetail)); }
public ActionResult Edit([Bind(Include = "Id,Name,Stock,BarCode,ShopId,MeasurementId")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MeasurementId = new SelectList(db.Measurements, "Id", "Name", product.MeasurementId); ViewBag.ShopId = new SelectList(db.Shops, "Id", "Name", product.ShopId); return(View(product)); }
public ActionResult AddorEdit_Product(Product prod)//we have to pass instance of object in defined stages of enity that's we have created instance { using (PosContext db = new PosContext()) { if (prod.ProductId == 0) { db.Products.Add(prod); db.SaveChanges(); return(Json(new { success = true, message = "saved Successfully" }, JsonRequestBehavior.AllowGet)); } else { db.Entry(prod).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, message = "saved Successfully" }, JsonRequestBehavior.AllowGet)); } } }
public bool Update(Measurement measurement) { db.Entry(measurement).State = EntityState.Modified; db.SaveChanges(); return(true); }
public bool Update(FinancialYear financialYear) { db.Entry(financialYear).State = EntityState.Modified; db.SaveChanges(); return(true); }
public static bool UpdateLog(Log entity) { try { using (var ctx = new PosContext()) { if (entity == null) throw new ArgumentNullException("Log not found with Id " + entity.Id); InsertLogArchive(entity); ctx.Entry(entity).State = EntityState.Modified; ctx.SaveChanges(); return true; } } catch (Exception ex) { return false; } }
public bool Update(Category category) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(true); }
public bool Update(Shop shop) { db.Entry(shop).State = EntityState.Modified; db.SaveChanges(); return(true); }
public bool Update(Product product) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(true); }
public bool Update(Brand brand) { db.Entry(brand).State = EntityState.Modified; db.SaveChanges(); return(true); }