// GET: PurchaseOrderContoller/Create public ActionResult Create() { var vendors = _vendorsRepository.FindAll(); var vendorsId = vendors.Select(q => new SelectListItem { Text = q.VendorName, Value = q.ID.ToString() }); var items = _itemsRepo.FindAll(); var itemsid = items.Select(q => new SelectListItem { Text = q.ItemName, Value = q.Id.ToString() }); var model = new PurchaseOrderVm { Vendors = vendorsId, Item = itemsid }; return(View(model)); }
// GET: InvoiceController/Create public ActionResult Create() { var vendors = _vendorsRepository.FindAll(); var vendorsId = vendors.Select(q => new SelectListItem { Text = q.VendorName, Value = q.ID.ToString() }); var items = _itemsRepo.FindAll(); var itemsid = items.Select(q => new SelectListItem { Text = q.ItemName, Value = q.Id.ToString() }); var itemscost = _itemsRepo.FindAll(); var Icost = itemscost.Select(q => new SelectListItem { Text = q.Cost.ToString(), Value = q.Cost.ToString() }); var POnumber = _POnumberRepo.FindAll(); var POnumberid = POnumber.Select(q => new SelectListItem { Text = q.PurchaseOrderNumber.ToString(), Value = q.PurchaseOrderNumber.ToString() }); var model = new InvoiceVm { Vendors = vendorsId, Item = itemsid, PurchaseOrders = POnumberid, Itemcost = Icost }; return(View(model)); }
// GET: VendorController public ActionResult Index() { var vendors = _repo.FindAll().ToList(); var model = _mapper.Map <List <Vendor>, List <VendorVm> >(vendors); return(View(model)); }