Ejemplo n.º 1
0
        public virtual async Task <List <DAL.App.DTO.DomainLikeDTO.Comment> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var query = RepositoryDbSet
                        .Include(a => a.CommentTitle).ThenInclude(t => t.Translations)
                        .Include(a => a.CommentBody).ThenInclude(t => t.Translations)
                        .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                        .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
                        .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
                        .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
                        .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).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)
                        .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 => CommentMapper.MapFromDomain(e)).ToList();

            return(res);
        }
Ejemplo n.º 2
0
 public async Task <List <DAL.App.DTO.Comment> > AllForFoodItemAsync(int foodItemId)
 {
     return(await RepositoryDbSet
            .Where(comment => comment.FoodItemId == foodItemId)
            .Include(comment => comment.AppUser)
            .Select(e => CommentMapper.MapFromDomain(e))
            .ToListAsync());
 }
Ejemplo n.º 3
0
 public override async Task <List <DAL.App.DTO.Comment> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(comment => comment.FoodItem)
            .Include(comment => comment.AppUser)
            .Select(comment => CommentMapper.MapFromDomain(comment))
            .ToListAsync());
 }
Ejemplo n.º 4
0
 public override async Task <List <Comment> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(a => a.CommentTitle).ThenInclude(t => t.Translations)
            .Include(a => a.CommentBody).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).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)
            .Select(e => CommentMapper.MapFromDomain(e)).ToListAsync());
 }
Ejemplo n.º 5
0
        public override async Task <Comment> FindAsync(params object[] id)
        {
            var comment = await RepositoryDbSet.FindAsync(id);

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