public ActionResult CreateEditI(int id) { var a = (Int32)Session["idi"]; ViewBag.id = a; InstallmentBillDetail inscashbilldetail = db.InstallmentBillDetails.Find(id); //var query = db.CashBillDetails.Where(cbd => cbd.ID == id).ToList(); //var b = query as List<CashBillDetail>; //var idpd = 0 ; //foreach (var chiTiet in b) //{ // idpd = chiTiet.ProductID; //} //var query2 = db.Products.Where(cbd => cbd.ID == idpd).ToList(); //var c = query2 as List<Product>; //var orgprice = 0; //foreach (var chiTiet in c) //{ // orgprice = chiTiet.OriginPrice; //} ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName"); var model = new InstallmentBillDetail(); model.BillID = id; model.Quantity = 1; return(View(model)); }
public ActionResult DeleteConfirmed(int id) { InstallmentBillDetail installmentBillDetail = db.InstallmentBillDetails.Find(id); db.InstallmentBillDetails.Remove(installmentBillDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete1(int id, int BillID) { InstallmentBillDetail iBillDetail = db.InstallmentBillDetails.Find(id); db.InstallmentBillDetails.Remove(iBillDetail); db.SaveChanges(); return(RedirectToAction("Edit/" + BillID, "InstallmentBills")); }
// GET: Admin/CashBillDetails/Create3 public PartialViewResult Create3() { ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName"); var ibillDetail = new InstallmentBillDetail(); ibillDetail.Quantity = 1; ibillDetail.BillID = 0; return(PartialView(ibillDetail)); }
// GET: Admin/InstallmentBillDetails/Create public ActionResult Create() { ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName"); var model = new InstallmentBillDetail(); model.ID = 0; model.Quantity = 1; return(PartialView(model)); }
public ActionResult Edit(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 Create([Bind(Include = "ID,BillID,ProductID,Quantity,InstallmentPrice")] InstallmentBillDetail installmentbilldetail) { if (ModelState.IsValid) { db.InstallmentBillDetails.Add(installmentbilldetail); 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)); }
// GET: /Admin/InstallBillDetail/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InstallmentBillDetail installmentbilldetail = db.InstallmentBillDetails.Find(id); if (installmentbilldetail == null) { return(HttpNotFound()); } return(View(installmentbilldetail)); }
public ActionResult CreateEditI(InstallmentBillDetail ibilldetail) { var a = (Int32)Session["idi"]; if (ModelState.IsValid) { db.InstallmentBillDetails.Add(ibilldetail); db.SaveChanges(); return(RedirectToAction("Edit", "InstallmentBills", new { id = a })); } ViewBag.BillID = new SelectList(db.CashBills, "ID", "BillCode", ibilldetail.BillID); ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductCode", ibilldetail.ProductID); return(View(ibilldetail)); }
// GET: /Admin/InstallBillDetail/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InstallmentBillDetail installmentbilldetail = db.InstallmentBillDetails.Find(id); if (installmentbilldetail == null) { return(HttpNotFound()); } 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 Edit2(InstallmentBillDetail iBillDetail) { if (ModelState.IsValid) { iBillDetail.ID = Environment.TickCount; iBillDetail.Product = db.Products.Find(iBillDetail.ProductID); var CTHoaDonTG = Session["IBillDetail"] as List <InstallmentBillDetail>; if (CTHoaDonTG == null) { CTHoaDonTG = new List <InstallmentBillDetail>(); } CTHoaDonTG.Add(iBillDetail); Session["IBillDetail"] = CTHoaDonTG; return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName", iBillDetail.ProductID); return(View("Create", iBillDetail)); }
public ActionResult Create2(InstallmentBillDetail iBillDetail) { if (ModelState.IsValid) { iBillDetail.ID = Environment.TickCount; iBillDetail.Product = db.Products.Find(iBillDetail.ProductID); var CTHoaDonTG = Session["IBillDetail"] as List <InstallmentBillDetail>; if (CTHoaDonTG == null) { CTHoaDonTG = new List <InstallmentBillDetail>(); } CTHoaDonTG.Add(iBillDetail); Session["IBillDetail"] = CTHoaDonTG; return(RedirectToAction("Create", "InstallmentBills")); } ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName", iBillDetail.ProductID); return(View("Create", iBillDetail)); }
public ActionResult Create2(InstallmentBillDetail model) { if (ModelState.IsValid) { model.ID = Environment.TickCount; model.Product = db.Products.Find(model.ProductID); var insctcashBill = Session["insctcashBill"] as List <InstallmentBillDetail>; if (insctcashBill == null) { insctcashBill = new List <InstallmentBillDetail>(); } insctcashBill.Add(model); Session["insctcashBill"] = insctcashBill; return(RedirectToAction("Create", "InstallmentBills")); } ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName", model.ProductID); return(View("Create", model)); }