public ActionResult InvoiceSearchResult(InvoiceUpdateViewModel InvoiceUpdateView) { InvoiceUpdateViewModel InvoiceUpdateViewModel = new InvoiceUpdateViewModel(); if (InvoiceUpdateView.OrderNumber != 0 && InvoiceUpdateView.OrderNumber != null) { var order = db.Orders.Include(a => a.Test).Where(x => x.OrderCode == InvoiceUpdateView.OrderNumber).ToList(); if (order.Count != 0) { var singleOrder = order.FirstOrDefault(a => a.OrderCode == InvoiceUpdateView.OrderNumber); InvoiceViewModel InvoiceViewModel = new InvoiceViewModel(); InvoiceViewModel.Doctor = db.Doctors.FirstOrDefault(x => x.Id == singleOrder.DoctorId); InvoiceViewModel.Patient = db.Patients.FirstOrDefault(x => x.Id == singleOrder.PatientId); InvoiceViewModel.Tests = db.Tests.Include(t => t.Department).Include(t => t.Specimen).Include(t => t.Unit).ToList(); InvoiceUpdateViewModel.Orders = order; InvoiceUpdateViewModel.OrderNumber = InvoiceUpdateView.OrderNumber; InvoiceUpdateViewModel.InvoiceViewModel = InvoiceViewModel; } else { return(RedirectToAction("InvoiceSearch", new { Message = "No data found with this order number." })); } } return(View(InvoiceUpdateViewModel)); }
public ActionResult DuePayment(InvoiceUpdateViewModel InvoiceUpdateViewModel) { return(RedirectToAction("DuePaymentSearchResult", new { OrderNumber = InvoiceUpdateViewModel.OrderNumber })); }
public ActionResult InvoiceSearch(string Message) { InvoiceUpdateViewModel InvoiceUpdateViewModel = new InvoiceUpdateViewModel(); InvoiceViewModel InvoiceViewModel = new InvoiceViewModel(); InvoiceViewModel.Tests = new List <Test>(); InvoiceViewModel.Doctor = new Doctor(); InvoiceViewModel.Patient = new Patient(); InvoiceUpdateViewModel.InvoiceViewModel = InvoiceViewModel; ViewBag.Message = Message; return(View(InvoiceUpdateViewModel)); }