BrandApplicationViewModel getInformationForCreateCompanyChoose(BrandApplicationViewModel gettingModel) // burada firma ekleme yapıldığında dönücek olanlar { ApplicationClassListViewModel appClass = gettingModel.applicationClassList; ApplicationSubClassListViewModel appSubClass = gettingModel.applicationSubClassList; BrandApplicationViewModel model = gettingModel; model = getBrandAppStandartValues(gettingModel); model.prices = _applicationPricesService.getPrices(model.selectedBrandApplication);//standart gelmesi gerek her zaman için model.brandApplicationVisibilty = _mapper.Map <BrandApplicationVisibilityViewModel>(_mainContext.brandApplicationVisiblities.Where(w => w.brandApplicationTypesId == gettingModel.selectedBrandApplication).FirstOrDefault()); if (model.brandApplicationVisibilty != null && model.brandApplicationVisibilty.applicationClassStatus) { // burada eğer sınıfların gelmesini istiyorsak listeyi çeker model.applicationClassList = _brandApplicationClassesService.getApplicationClassList(); model.applicationSubClassList = _brandApplicationClassesService.getApplicationSubClassList(model.subclassSearchText); foreach (var item in model.applicationClassList.applicationClassList) { var selectedClass = appClass.applicationClassList.Where(w => w.id == item.id).FirstOrDefault(); item.additionalClass = selectedClass.additionalClass; item.isSelected = selectedClass.isSelected; } foreach (var item in model.applicationSubClassList.subList) { var selectedClass = appSubClass.subList.Where(w => w.id == item.id).FirstOrDefault(); item.isSelected = selectedClass.isSelected; } double calculatedPrice = _applicationPricesService.brandApplicationTotalPrice(model); model.prices.totalPrice = calculatedPrice; } if (model.brandApplicationVisibilty != null && model.brandApplicationVisibilty.companiesListStatus) { model.companieList = _companiesService.GetCompanyList(_usersService.getUserInformation(_cookieService.getSessionEmail()).userId); } return(model); }
public ApplicationClassListViewModel getApplicationClassList() { ApplicationClassListViewModel model = new ApplicationClassListViewModel(); model.applicationClassList = _mapper.Map <IList <ApplicationClassViewModel> >(_mainContext.applicationClasses.ToList()); return(model); }
public ApplicationClassListViewModel applicationClassFillWithSelecteds(ApplicationClassListViewModel mainClass, ApplicationSubClassListViewModel subclass) { foreach (var item in mainClass.applicationClassList) { if (subclass.subList.Where(w => w.isSelected == true && w.appclassId == item.id).Count() > 0) { item.isSelected = true; } } return(mainClass); }