public FeedbackDto GetFeedbackById(GetFeedbackByIdDto dto) { return(ctx.Feedbacks. Include(p => p.Party).ThenInclude(p => p.StoreCategories).ThenInclude(p => p.StoreCategory). Where(p => p.Id == dto.Id). 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)). FirstOrDefault()); }
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()); }