Beispiel #1
0
        public GetFeedbacksByPageResultDto Execute(GetFeedbacksByPageDto dto)
        {
            GetFeedbacksByPageResultDto result = new GetFeedbacksByPageResultDto {
                Status = true, Page = new PageDto {
                    PageNo = dto.PageNo
                }
            };
            List <FeedbackDto> lst = unit.Feedback.GetFeedbacksByPage(dto);

            result.Object            = lst;
            result.Page.Total        = unit.Feedback.GetFeedbacksByPageCount(dto);
            result.Page.CurrentCount = lst.Count;
            return(result);
        }
Beispiel #2
0
 public List <FeedbackDto> GetFeedbacksByPage(GetFeedbacksByPageDto dto)
 {
     return(ctx.Feedbacks.
            Skip((dto.PageNo - 1) * AdminSettings.Block).
            Take(AdminSettings.Block).
            Include(p => p.Party).ThenInclude(p => p.StoreCategories).ThenInclude(p => p.StoreCategory).
            Where(p =>
                  (dto.UserId == null || p.Party.UserId == dto.UserId) &&
                  (dto.From == 0 || (p.CreatedAt >= dto.From && p.CreatedAt <= dto.To)) &&
                  (dto.CategoryId == null || p.Party.StoreCategories.Any(q => q.StoreCategoryId == dto.CategoryId))).
            Include(p => p.Party).ThenInclude(p => p.StoreImages).ThenInclude(p => p.Document).
            Include(p => p.Party).ThenInclude(p => p.User).
            Select(p => DtoBuilder.CreateFeedbackDto(p)).
            ToList());
 }
Beispiel #3
0
 public ActionResult <GetFeedbacksByPageResultDto> GetFeedbacksByPage([FromQuery] GetFeedbacksByPageDto dto)
 {
     return(getFeedbacksByPage.Execute(dto));
 }
Beispiel #4
0
 public int GetFeedbacksByPageCount(GetFeedbacksByPageDto dto)
 {
     return(ctx.Feedbacks.Include(p => p.Party).
            Where(p => dto.UserId == null || p.Party.UserId == dto.UserId).
            Count());
 }