// GET: CustomersController/Create public ActionResult Create() { var parishes = _parishRepo.FindAll() .Select(q => new SelectListItem { Text = q.Parishes, Value = q.Id.ToString() }); var model = new CustomerViewModel { Parishes = parishes }; return(View(model)); }
// GET: ParishesController public ActionResult Index() { var parishes = _repo.FindAll().ToList(); var model = _mapper.Map <List <Parish>, List <ParishViewModel> >(parishes); return(View(model)); }
// GET: SupplierController public ActionResult Index() { var suppliers = _repo.FindAll().ToList(); var parishes = _parishRepo.FindAll() .Select(q => new SelectListItem { Text = q.Parishes, Value = q.Id.ToString() });; var model = _mapper.Map <List <Supplier>, List <SupplierViewModel> >(suppliers); return(View(model)); // var DeliveryStatus = _repo.FindAll(); //var DeliveryModel = _mapper.Map<List<SupplierViewModel>>(DeliveryStatus); //var model = new DeliveryStatusViewModel //{ // TotalDelivery = DeliveryModel.Count, // Delivered = DeliveryModel.Count(q => q.Approved == true), // PendingDelivery = DeliveryModel.Count(q => q.Approved == null), // NotDelivered = DeliveryModel.Count(q => q.Approved == false) // //Products = DeliveryModel //}; // return View(model); //var SupplierModel = _mapper.Map<List<SupplierViewModel>>(suppliers); //var model1 = new DeliveryStatusViewModel // return View(model); //{ // TotalDelivery = SupplierModel.Count, // PendingDelivery = SupplierModel.Count(q => q.Approved == null), // NotDelivered = SupplierModel.Count(q => q.Approved == false), // //suppliers = SupplierModel //}; //return View(model); }