private List <CategoryViewModel> ConvertDataToViewModels(List <CategoryData> domainModels) { var viewModels = new List <CategoryViewModel>(); foreach (var item in domainModels) { CategoryViewModelBuilder builder = BuilderResolverService.Get <CategoryViewModelBuilder, CategoryData>(item); Constructor.ConstructViewModelData(builder); viewModels.Add(builder.GetViewModel()); } return(viewModels); }
public CategoryViewModel Get(int?categoryId) { var viewModel = new CategoryViewModel(); if (categoryId.HasValue) { CategoryData domainModel = CategoryRepository.GetDataById(categoryId.Value); CategoryViewModelBuilder builder = BuilderResolverService.Get <CategoryViewModelBuilder, CategoryData>(domainModel); Constructor.ConstructViewModelData(builder); viewModel = builder.GetViewModel(); } return(viewModel); }