Пример #1
0
        public ActionResult Create()
        {
            var model = new CreateProductViewModel();

            var productTypes = from ProductType t in Enum.GetValues(typeof(ProductType))
                               select new
            {
                ID   = (int)t,
                Name = t.ToString()
            };

            model.ProductTypes  = new SelectList(productTypes, "ID", "Name");
            model.ProductTypeId = -1;

            var timeEpochs = from TimeEpoch t in Enum.GetValues(typeof(TimeEpoch))
                             select new
            {
                ID   = (int)t,
                Name = t.ToString()
            };

            model.TimeEpochs  = new SelectList(timeEpochs, "ID", "Name");
            model.TimeEpochId = -1;

            model.Suppliers = new SelectList(_productFacade.GetSuppliers(), "Id", "Name");
            model.Designers = new SelectList(_productFacade.GetDesigners(), "Id", "Name");

            return(View(model));
        }