Exemple #1
0
        // GET: Products/Create
        public async Task <ActionResult> Create()
        {
            CreateProductsVM model = new CreateProductsVM();

            var providers = await _providersService.GetAll();

            model.Providers = providers.Select(l => new SelectListItem()
            {
                Text  = l.ProvName,
                Value = l.Id.ToString()
            });
            model.ProvidId = providers != null && providers.Any() ? providers.First().Id : 0;


            var locations = await _locationService.GetAll();

            model.Locations = locations.Select(l => new SelectListItem()
            {
                Text  = l.LocName,
                Value = l.Id.ToString()
            });
            model.LocId = locations != null && locations.Any() ? locations.First().Id : 0;

            //ViewBag.ProvId = new SelectList(db.Providers, "ProvId", "ProvName");
            return(View(model));
        }
Exemple #2
0
        // GET: Providers
        public async Task <ActionResult> Index()
        {
            IEnumerable <Providers> products = await _providersService.GetAll();

            List <IndexVM> indexVMList = new List <IndexVM>();

            foreach (var prov in products)
            {
                IndexVM IndVM = new IndexVM()
                {
                    Id       = prov.Id,
                    ProvName = prov.ProvName,
                    Notes    = prov.Notes
                };

                indexVMList.Add(IndVM);
            }

            return(View(indexVMList));
        }