public ActionResult Index() { var model = new RfqViewModel(); var rfqs = _rfqRepository.GetRfqs().Where(x => x.IsOpen).ToList(); if (rfqs != null && rfqs.Count > 0) { model.Rfqs = new List <RfqViewModel>(); foreach (var rfq in rfqs) { RfqViewModel convertedModel = new RfqConverter().ConvertToListView(rfq); model.Rfqs.Add(convertedModel); } } return(View(model)); }
/// <summary> /// admin dashboard /// </summary> /// <returns></returns> public ActionResult Admin() { var model = new DashboardViewModel(); var _db = new SouthlandDb(); var currentDate = DateTime.Today.AddMonths(-1); var projects = new List <ProjectViewModel>(); var tempProjects = _projectRepository.GetProjects().Where(x => x.IsHold).ToList(); if (tempProjects != null && tempProjects.Count > 0) { foreach (var tempProject in tempProjects) { ProjectViewModel convertedModel = new ProjectConverter().ConvertToListView(tempProject); projects.Add(convertedModel); } } model.OnHoldProjects = projects; var rfqs = new List <RfqViewModel>(); var tempRfqs = _rfqRepository.GetRfqs().Where(x => x.IsHold).ToList(); if (tempRfqs != null && tempRfqs.Count > 0) { foreach (var tempRfq in tempRfqs) { RfqViewModel convertedModel = new RfqConverter().ConvertToListView(tempRfq); rfqs.Add(convertedModel); } } model.OnHoldRfqs = rfqs; var quotes = new List <QuoteViewModel>(); var tempQuotes = _quoteRepository.GetQuotes().Where(x => x.IsHold).ToList(); if (tempQuotes != null && tempQuotes.Count > 0) { foreach (var tempQuote in tempQuotes) { QuoteViewModel convertedModel = new QuoteConverter().ConvertToListView(tempQuote); quotes.Add(convertedModel); } } model.OnHoldQuotes = quotes; var customerOrders = new List <CustomerOrderViewModel>(); var tempCustomerOrders = _customerOrderRepository.GetCustomerOrders().Where(x => x.IsHold).ToList(); if (tempCustomerOrders != null && tempCustomerOrders.Count > 0) { foreach (var tempCustomerOrder in tempCustomerOrders) { CustomerOrderViewModel convertedModel = new CustomerOrderConverter().ConvertToListView(tempCustomerOrder); customerOrders.Add(convertedModel); } } model.OnHoldCustomerOrders = customerOrders; var foundryOrders = new List <FoundryOrderViewModel>(); var tempFoundryOrders = _foundryOrderRepository.GetFoundryOrders().Where(x => x.IsHold).ToList(); if (tempFoundryOrders != null && tempFoundryOrders.Count > 0) { foreach (var tempFoundryOrder in tempFoundryOrders) { FoundryOrderViewModel convertedModel = new FoundryOrderConverter().ConvertToListView(tempFoundryOrder); foundryOrders.Add(convertedModel); } } model.OnHoldFoundryOrders = foundryOrders; var packingLists = new List <PackingListViewModel>(); var tempPackingLists = _packingListRepository.GetPackingLists().Where(x => !x.IsClosed).ToList(); if (tempPackingLists != null && tempPackingLists.Count > 0) { foreach (var tempPackingList in tempPackingLists) { PackingListViewModel convertedModel = new PackingListConverter().ConvertToListView(tempPackingList); packingLists.Add(convertedModel); } } model.OpenPackingLists = packingLists; return(View(model)); }