Esempio n. 1
0
        public async Task <List <Return> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var query = RepositoryDbSet
                        .Include(a => a.Description).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.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode)
                        .ThenInclude(t => t.Translations)
                        .Where(p => p.ShopId == shopId)
                        .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 => ReturnMapper.MapFromDomain(e)).ToList();

            return(res);
        }
Esempio n. 2
0
 public override async Task <List <Return> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(a => a.Description).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.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
            .Select(e => ReturnMapper.MapFromDomain(e)).ToListAsync());
 }
Esempio n. 3
0
        public override async Task <Return> FindAsync(params object[] id)
        {
            var @return = await RepositoryDbSet.FindAsync(id);

            return(ReturnMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == @return.Id)
                                              .Include(a => a.Description).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.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
                                              .FirstOrDefaultAsync()));
        }