public override async Task <List <DAL.App.DTO.DomainLikeDTO.Category> > AllAsync() { return(await RepositoryDbSet .Include(a => a.CategoryName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations) .Include(a => a.ProductsInCategory).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName) .ThenInclude(t => t.Translations) .Select(e => CategoryMapper.MapFromDomain(e)).ToListAsync()); }
public override async Task <DAL.App.DTO.DomainLikeDTO.Category> FindAsync(params object[] id) { var category = await RepositoryDbSet.FindAsync(id); return(CategoryMapper.MapFromDomain(await RepositoryDbSet .Include(a => a.CategoryName).ThenInclude(t => t.Translations) .Where(a => a.Id == category.Id) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations) .Include(a => a.ProductsInCategory).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName) .ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
public virtual async Task <List <DAL.App.DTO.DomainLikeDTO.Category> > AllAsync(string order, string searchFor, int?pageIndex, int?pageSize) { var query = RepositoryDbSet .Include(a => a.CategoryName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations) .Include(a => a.ProductsInCategory).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName) .ThenInclude(t => t.Translations).AsQueryable(); query = Search(query, searchFor); query = Order(query, order); if (pageIndex != null && pageSize != null) { query = query.Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value); } var temp = await query.ToListAsync(); var res = temp.Select(e => CategoryMapper.MapFromDomain(e)).ToList(); return(res); }