public ViewResult Detail(Guid id) { car dbItem = RepoCar.FindByPk(id); CarPresentationStub model = new CarPresentationStub(dbItem); return(View(model)); }
public ActionResult Index() { //kamus Guid? idOwner = (User as CustomPrincipal).IdOwner; List <car> dbCarList = new List <car>(); List <CarPresentationStub> pCarList = new List <CarPresentationStub>(); Dictionary <string, string> jsonCarListByModel = new Dictionary <string, string>(); List <string> carModels; List <GenericModel> gCarList; Boolean active = true; Business.Infrastructure.FilterInfo filters; //algoritma filters = new Business.Infrastructure.FilterInfo { Filters = new List <Business.Infrastructure.FilterInfo> { new Business.Infrastructure.FilterInfo { Field = "id_owner", Operator = "eq", Value = idOwner.ToString() }, new Business.Infrastructure.FilterInfo { Field = "is_active", Operator = "eq", Value = active.ToString() }, }, Logic = "and" }; dbCarList = RepoCar.FindAll(null, null, null, filters); pCarList = new CarPresentationStub().MapList(dbCarList); carModels = pCarList.Select(m => m.CarModelName).Distinct().ToList(); foreach (string cm in carModels) { gCarList = new List <GenericModel>(); foreach (CarPresentationStub single in pCarList.Where(n => n.CarModelName == cm).ToList()) { gCarList.Add(new GenericModel { text = single.LicensePlate, value = single.LicensePlate }); } jsonCarListByModel.Add(cm.Replace(" ", "_"), new JavaScriptSerializer().Serialize(gCarList)); } //viewbag ViewBag.JsonCarListByModel = jsonCarListByModel; return(View(new DailyFilterModel())); }