Beispiel #1
0
        public PagedResponse <SectionMemberDTO> GetAllMembersPaged(int sectionId, PagedRequestOptions options, Expression <Func <SectionMember, bool> > filter)
        {
            var response = new PagedResponse <SectionMemberDTO>()
            {
                Options = options
            };
            var test = Context.SectionMembers.Where(sm => sm.SectionId == sectionId)
                       .Include(sm => sm.Role)
                       .Include(s => s.Member)
                       .ThenInclude(m => m.Person).ToList();

            // response.Values = Context.SectionMembers
            //                         .Include(sm => sm.Role)
            //                         .Include(s => s.Member)
            //                         .ThenInclude(m => m.Person)
            //                         .AsQueryable()
            //                         //.ApplyFilter(filter)
            //                         .ComputeTotalCount(response)
            //                         .ValidatePropertyExists(Context, options.Sort)
            //                         .ApplySort(options.Sort, options.SortDirection)
            //                         .ApplyPaging(options.StartIndex, options.Count)
            //                         .ToDTO<SectionMember, SectionMemberDTO>()
            //                         .ToList();

            return(response);
        }
        public PagedResponse <NewsletterSubscriberDTO> GetAllPaged(PagedRequestOptions options, Expression <Func <NewsletterSubscriber, bool> > filter = null)
        {
            var response = new PagedResponse <NewsletterSubscriberDTO>()
            {
                Options = options
            };

            response.Values = Context.NewsletterSubscribers
                              .AsQueryable()
                              .ApplyFilter(filter)
                              .ComputeTotalCount(response)
                              .ValidatePropertyExists(Context, options.Sort)
                              .ApplySort(options.Sort, options.SortDirection)
                              .ApplyPaging(options.StartIndex, options.Count)
                              .ToDTO <NewsletterSubscriber, NewsletterSubscriberDTO>()
                              .ToList();

            return(response);
        }
Beispiel #3
0
        public PagedResponse <PaymentDTO> GetAllPaged(PagedRequestOptions options, Expression <Func <Payment, bool> > filter = null)
        {
            var response = new PagedResponse <PaymentDTO>()
            {
                Options = options
            };

            response.Values = Context.Payments
                              .Include(a => a.PaymentMembers)
                              .AsQueryable()
                              .ApplyFilter(filter)
                              .ComputeTotalCount(response)
                              .ValidatePropertyExists(Context, options.Sort)
                              .ApplySort(options.Sort, options.SortDirection)
                              .ApplyPaging(options.StartIndex, options.Count)
                              .ToDTO <Payment, PaymentDTO>()
                              .ToList();

            return(response);
        }
Beispiel #4
0
        public PagedResponse <AlbumDTO> Get([FromQuery] PagedRequestOptions options, [FromQuery] string filter)
        {
            Expression <Func <Album, bool> > predicate = null;

            if (!string.IsNullOrWhiteSpace(filter))
            {
                var f = filter.Trim().ToUpper();

                predicate = PredicateBuilder.New <Album>();
                predicate = predicate.Or(a => a.Title.ToUpper().Contains(f));
            }

            if (string.IsNullOrWhiteSpace(options.Sort))
            {
                options.Sort = nameof(Album.ActivityDate);
            }

            var result = _albumsLogic.GetAllPaged(options, predicate);

            return(result);
        }
Beispiel #5
0
        public PagedResponse <PaymentDTO> Get([FromQuery] PagedRequestOptions options, [FromQuery] string filter)
        {
            Expression <Func <Payment, bool> > predicate = null;

            if (!string.IsNullOrWhiteSpace(filter))
            {
                var f = filter.Trim().ToUpper();

                predicate = PredicateBuilder.New <Payment>();
                predicate = predicate.Or(a => a.Name.ToUpper().Contains(f));
            }

            if (string.IsNullOrWhiteSpace(options.Sort))
            {
                options.Sort = nameof(Payment.CreationDate);
            }

            var result = _paymentsLogic.GetAllPaged(options, predicate);

            return(result);
        }
        public PagedResponse <NewsletterSubscriberDTO> Get([FromQuery] PagedRequestOptions options, [FromQuery] string filter)
        {
            Expression <Func <NewsletterSubscriber, bool> > predicate = null;

            if (!string.IsNullOrWhiteSpace(filter))
            {
                var f = filter.Trim().ToUpper();

                predicate = PredicateBuilder.New <NewsletterSubscriber>();
                predicate = predicate.Or(n => n.Email.ToUpper().Contains(f));
                predicate = predicate.Or(n => n.Name.ToUpper().Contains(f));
            }

            if (string.IsNullOrWhiteSpace(options.Sort))
            {
                options.Sort = nameof(NewsletterSubscriber.Email);
            }

            var result = _newsletterSubscribersLogic.GetAllPaged(options, predicate);

            return(result);
        }
Beispiel #7
0
        public PagedResponse <MemberDTO> Get([FromQuery] PagedRequestOptions options, [FromQuery] string filter)
        {
            Expression <Func <Member, bool> > predicate = null;

            if (!string.IsNullOrWhiteSpace(filter))
            {
                var f = filter.Trim().ToUpper();

                predicate = PredicateBuilder.New <Member>();
                predicate = predicate.Or(m => m.Person.LastName.ToUpper().Contains(f));
                predicate = predicate.Or(m => m.Person.FirstName.ToUpper().Contains(f));
            }

            if (string.IsNullOrWhiteSpace(options.Sort))
            {
                options.Sort = nameof(Member.Id);
            }

            var result = _membersLogic.GetAllPaged(options, predicate);

            return(result);
        }
Beispiel #8
0
        public PagedResponse <NewsDTO> Get([FromQuery] PagedRequestOptions options, [FromQuery] string filter)
        {
            Expression <Func <News, bool> > predicate = null;

            if (!string.IsNullOrWhiteSpace(filter))
            {
                var f = filter.Trim().ToUpper();

                predicate = PredicateBuilder.New <News>();
                predicate = predicate.Or(a => a.Title.ToUpper().Contains(f));
            }

            if (string.IsNullOrWhiteSpace(options.Sort))
            {
                options.Sort          = nameof(News.CreationDate);
                options.SortDirection = SortDirection.DESC;
            }

            var result = _newsLogic.GetAllPaged(options, predicate);

            return(result);
        }
Beispiel #9
0
        public PagedResponse <MemberDTO> GetAllPaged(PagedRequestOptions options, Expression <Func <Member, bool> > filter = null)
        {
            var response = new PagedResponse <MemberDTO>()
            {
                Options = options
            };

            response.Values = Context.Members
                              .Include(m => m.Person)
                              .ThenInclude(mPerson => mPerson.PersonRoles)
                              .ThenInclude(mPersonRoles => mPersonRoles.Role)
                              .Include(m => m.SectionMembers)
                              .ThenInclude(ms => ms.Section)
                              .AsQueryable()
                              .ApplyFilter(filter)
                              .ComputeTotalCount(response)
                              .ValidatePropertyExists(Context, options.Sort)
                              .ApplySort(options.Sort, options.SortDirection)
                              .ApplyPaging(options.StartIndex, options.Count)
                              .ToDTO <Member, MemberDTO>()
                              .ToList();

            return(response);
        }
Beispiel #10
0
        public PagedResponse <SectionMemberDTO> GetMembers(int id, [FromQuery] PagedRequestOptions options, [FromQuery] string filter)
        {
            Expression <Func <SectionMember, bool> > predicate = null;

            predicate = PredicateBuilder.New <SectionMember>();
            predicate = predicate.Or(sm => sm.SectionId == id);
            if (!string.IsNullOrWhiteSpace(filter))
            {
                var f = filter.Trim().ToUpper();

                predicate = predicate.Or(sm => sm.Member.Person.LastName.ToUpper().Contains(f));
                predicate = predicate.Or(sm => sm.Member.Person.FirstName.ToUpper().Contains(f));
                predicate = predicate.Or(sm => sm.Role.Name.ToUpper().Contains(f));
            }

            if (string.IsNullOrWhiteSpace(options.Sort))
            {
                options.Sort = nameof(SectionMember.Id);
            }

            var result = _sectionsLogic.GetAllMembersPaged(id, options, predicate);

            return(result);
        }