public ActionResult Create(BillDetail billdetail) { if (ModelState.IsValid) { db.BillDetail.Add(billdetail); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Bill = new SelectList(db.Bill, "Id", "PaymentType", billdetail.Bill); ViewBag.Product = new SelectList(db.Products, "Id", "Name", billdetail.Product); return View(billdetail); }
public ActionResult Edit(BillDetail billdetail) { if (ModelState.IsValid) { db.Entry(billdetail).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Bill = new SelectList(db.Bill, "Id", "PaymentType", billdetail.Bill); ViewBag.Product = new SelectList(db.Products, "Id", "Name", billdetail.Product); return View(billdetail); }