Example #1
0
        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);
        }
Example #2
0
 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);
 }