コード例 #1
0
        public async Task <List <DTO.DomainLikeDTO.Order> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var query = RepositoryDbSet
                        .Include(m => m.Description).ThenInclude(t => t.Translations)
                        .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperName).ThenInclude(t => t.Translations)
                        .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperAddress).ThenInclude(t => t.Translations)
                        .Include(a => a.Shipper).ThenInclude(aa => aa.PhoneNumber).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.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode)
                        .ThenInclude(t => t.Translations)
                        .Where(a => a.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 => OrderMapper.MapFromDomain(e)).ToList();

            return(res);
        }
コード例 #2
0
 public override async Task <List <Order> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(m => m.Description).ThenInclude(t => t.Translations)
            .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperName).ThenInclude(t => t.Translations)
            .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperAddress).ThenInclude(t => t.Translations)
            .Include(a => a.Shipper).ThenInclude(aa => aa.PhoneNumber).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.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
            .Select(e => OrderMapper.MapFromDomain(e)).ToListAsync());
 }
コード例 #3
0
 public async Task <DTO.DomainLikeDTO.Order> FindAsyncById(int id)
 {
     return(OrderMapper.MapFromDomain(await RepositoryDbSet
                                      .Include(m => m.Description).ThenInclude(t => t.Translations)
                                      .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperName).ThenInclude(t => t.Translations)
                                      .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperAddress).ThenInclude(t => t.Translations)
                                      .Include(a => a.Shipper).ThenInclude(aa => aa.PhoneNumber).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.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                                      .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
                                      .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
                                      .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
                                      .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
                                      .Where(o => o.Id == id).FirstOrDefaultAsync()));
 }
コード例 #4
0
        public override async Task <Order> FindAsync(params object[] id)
        {
            var order = await RepositoryDbContext.Set <Domain.Order>().FindAsync(id);

            RepositoryDbContext.Entry(order).State = EntityState.Detached;

            return(OrderMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == order.Id)
                                             .Include(m => m.Description).ThenInclude(t => t.Translations)
                                             .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperName).ThenInclude(t => t.Translations)
                                             .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperAddress).ThenInclude(t => t.Translations)
                                             .Include(a => a.Shipper).ThenInclude(aa => aa.PhoneNumber).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.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                                             .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
                                             .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
                                             .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
                                             .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
                                             .FirstOrDefaultAsync()));
        }