Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }