public ActionResult AddInvoice(InvoicingViewModel invoiceView) { if (ModelState.IsValid) { //allow the user to add the next invoice return(RedirectToAction("AddInvoice")); } else { //display the invoice form since ViewBag.InvoiceFormScope = InvoiceFormType.Add; return(View("InvoicePage", invoiceView)); } }
public ActionResult Index() { var projects = this._projectsProvider.GetAll().Select(u => new SelectListItem { Text = u.ProjectName, Value = u.ProjectId.ToString() }).ToList(); projects.Insert(0, new SelectListItem() { Text = "", Value = "" }); var model = new InvoicingViewModel() { ProjectsOptions = projects }; return(View(model)); }