public ActionResult VerifyCreditIndex() { List <WorkOrder> workOrderList = new List <WorkOrder>(); workOrderList = db.WorkOrders.ToList(); List <WorkOrder> workOrderListToModify = new List <WorkOrder>(); workOrderListToModify = db.WorkOrders.ToList(); foreach (WorkOrder wo in workOrderList) { if (wo.IsVerified == true) { workOrderListToModify.Remove(wo); } } List <VerifyCreditViewModel> viewModelList = new List <VerifyCreditViewModel>(); foreach (WorkOrder wo in workOrderListToModify) { VerifyCreditViewModel viewModel = new VerifyCreditViewModel(); viewModel.WorkOrderID = wo.WorkOrderID; viewModel.CustCompany = db.Customers.Find(wo.CustID).CustCompany; viewModel.CustFirstName = db.Customers.Find(wo.CustID).CustFirstName; viewModel.CustLastName = db.Customers.Find(wo.CustID).CustLastName; viewModelList.Add(viewModel); } return(View(viewModelList)); }
public ActionResult VerifyCredit(int?id) { WorkOrder wo = db.WorkOrders.Find(id); VerifyCreditViewModel viewModel = new VerifyCreditViewModel(); viewModel.WorkOrderID = db.WorkOrders.Find(id).WorkOrderID; viewModel.CustCompany = db.Customers.Find(wo.CustID).CustCompany; viewModel.CustFirstName = db.Customers.Find(wo.CustID).CustFirstName; viewModel.CustLastName = db.Customers.Find(wo.CustID).CustLastName; return(View(viewModel)); }