예제 #1
0
        public async Task <List <ViewDTO> > GetAll()
        {
            var allViews = await _repository.GetAll();

            return(allViews.Select(x => new ViewDTO()
            {
                Id = x.Id,
                Name = x.Name,
                Description = x.Description,
                RequiresApproval = x.RequiresApproval,
                ShowNames = x.ShowNames,
                Categories = x.ViewCategories.Select(vc => new ViewCategoryDetailsDTO()
                {
                    Id = vc.CategoryId,
                    Name = vc.Category.Name
                }).ToList()
            }).ToList());
        }