public ActionResult Create(CarItemViewModel model) { var dbOptions = _carOptionsManager.GetAll().ToList(); foreach (var item in dbOptions) { model.AvalibleCarOptions.Add(_carOptionFieldCopier.CopyFields(item, new CarOptionViewModel())); } ModelState.Clear(); return(View(model)); }
// GET: Home public ActionResult Index(CarAggregateFilterViewModel filter) { if (filter == null) { filter = new CarAggregateFilterViewModel(); } foreach (var co in _carOptionManager.GetAll()) { filter.AvalibleCarOptions.Add(_carOptionFieldCopier.CopyFields(co, new CarOptionViewModel())); } ViewBag.CarFilter = filter; return(View(new List <CarAggregateViewModel>())); }
public JsonResult ChecCarOptionNameForExist(CarOptionViewModel model) { model.Name = model.Name.TrimStart(' '); model.Name = model.Name.TrimEnd(' '); return(Json(_carOptionManager.GetAll().Where(c => c.Name == model.Name && c.Id != model.Id).ToList().Count <= 0, JsonRequestBehavior.AllowGet)); }