public ActionResult Create(InvoiceDetail invoicedetail) { if (ModelState.IsValid) { invoicedetailRepository.InsertOrUpdate(invoicedetail); invoicedetailRepository.Save(); return(RedirectToAction("Index")); } else { ViewBag.PossibleInvoices = invoiceRepository.All; ViewBag.PossibleProducts = productRepository.All; return(View()); } }