public ActionResult Create(Invoice invoice) { if (ModelState.IsValid) { db.Invoices.Add(invoice); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RegistrationId = new SelectList(db.Registrations, "Id", "Remarks", invoice.RegistrationId); return View(invoice); }
public ActionResult Edit(Invoice invoice) { if (ModelState.IsValid) { db.Entry(invoice).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RegistrationId = new SelectList(db.Registrations, "Id", "Remarks", invoice.RegistrationId); return View(invoice); }