public ActionResult Edit(CashBill model) { if (ModelState.IsValid) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(InstallmentBill model) { if (ModelState.IsValid) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerID = new SelectList(db.Customers, "ID", "CustomerCode", model.CustomerID); return(View(model)); }
public ActionResult Edit([Bind(Include = "ID,BillID,ProductID,Quantity,InstallmentPrice")] InstallmentBillDetail installmentBillDetail) { if (ModelState.IsValid) { db.Entry(installmentBillDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BillID = new SelectList(db.InstallmentBills, "ID", "BillCode", installmentBillDetail.BillID); ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductCode", installmentBillDetail.ProductID); return(View(installmentBillDetail)); }
public ActionResult Edit(CashBillDetail cashbilldetail) { var a = (Int32)Session["id"]; if (ModelState.IsValid) { db.Entry(cashbilldetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit", "CashBills", new { id = a })); } ViewBag.BillID = new SelectList(db.CashBills, "ID", "BillCode", cashbilldetail.BillID); ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductCode", cashbilldetail.ProductID); return(View(cashbilldetail)); }
public ActionResult Edit(Product model) { CheckBangSanPham(model); if (ModelState.IsValid) { using (var scope = new TransactionScope()) { db.Entry(model).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); var path = Server.MapPath("~/App_Data"); path = path + "/" + model.ID; if (Request.Files["HinhAnh"] != null && Request.Files["HinhAnh"].ContentLength > 0) { Request.Files["HinhAnh"].SaveAs(path); } scope.Complete(); return(RedirectToAction("Index")); } } //ViewBag.ProductType = db.ProductTypes.OrderByDescending(x => x.ID).ToList(); ViewBag.ProductTypeID = new SelectList(db.ProductTypes, "ID", "ProductTypeName", model.ProductTypeID); return(View(model)); }