public IActionResult BillProcess(string p, string date, string bills, BillingBillViewModel model) { model.Patient = IPatientService.GetPatient(p); if (model.Patient == null) { return(LocalRedirect("/billing/cashier?error=1043")); } try { model.Date = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture); } catch (Exception) { return(LocalRedirect("/billing/cashier?error=4509")); } List <BillsItem> items = IFinanceService.GetBillsItems(bills); foreach (var itm in items) { model.Items.Add(new InvoiceDetails { Checked = true, Item = itm }); } model.Invoice.Patient = model.Patient; model.Bills = bills; return(View(model)); }