Пример #1
0
        public ActionResult Add()
        {
            IDropDown    _dropdownrepo = RepositoryFactory.CreateDropDowns();
            CarViewModel carVM         = new CarViewModel();

            carVM.Car = new Car();
            carVM.SetMakes(_dropdownrepo.MakeDropdown());
            carVM.SetModels(_dropdownrepo.ModelDropdown());
            carVM.SetTypes(_dropdownrepo.TypeDropdown());
            carVM.SetBodyStyles(_dropdownrepo.BodyStyleDropdown());
            carVM.SetTransmissions(_dropdownrepo.TransmissionDropdown());
            carVM.SetExteriorColor(_dropdownrepo.ExteriorColorDropdown());
            carVM.SetInteriorColor(_dropdownrepo.InteriorColorDropdown());
            return(View(carVM));
        }
Пример #2
0
        public ActionResult Edit(int id)
        {
            ICarDealerRepository _repo         = RepositoryFactory.Create();
            IDropDown            _dropdownrepo = RepositoryFactory.CreateDropDowns();
            CarViewModel         carVM         = new CarViewModel();

            carVM.Car = _repo.GetCarById(id);
            carVM.SetMakes(_dropdownrepo.MakeDropdown());
            carVM.SetModels(_dropdownrepo.ModelDropdown());
            carVM.SetTypes(_dropdownrepo.TypeDropdown());
            carVM.SetBodyStyles(_dropdownrepo.BodyStyleDropdown());
            carVM.SetTransmissions(_dropdownrepo.TransmissionDropdown());
            carVM.SetExteriorColor(_dropdownrepo.ExteriorColorDropdown());
            carVM.SetInteriorColor(_dropdownrepo.InteriorColorDropdown());
            return(View(carVM));
        }