예제 #1
0
        public async Task <IActionResult> Get([FromQuery] ContactGroupQueryParameters contactGroupQueryParameters)
        {
            var contactGroups = await _contactGroupService.GetContactGroups(contactGroupQueryParameters);

            var metadata = new
            {
                contactGroups.TotalCount,
                contactGroups.PageSize,
                contactGroups.CurrentPage,
                contactGroups.TotalPages,
                contactGroups.HasNext,
                contactGroups.HasPrevious
            };

            Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(metadata));

            _logger.LogInformation($"Returned {contactGroups.TotalCount} contact Groups from database.");

            return(Ok(contactGroups));
        }
예제 #2
0
        public async Task <PagedList <ContactGroup> > GetContactGroups(ContactGroupQueryParameters contactGroupQueryParameters)
        {
            var contact = await _repositoryWrapper.contactGroup.GetContactGroups(contactGroupQueryParameters);

            return(contact);
        }
 public async Task <PagedList <ContactGroup> > GetContactGroups(ContactGroupQueryParameters contactQueryParameters)
 {
     return(PagedList <ContactGroup> .ToPagedList(FindAll(),
                                                  contactQueryParameters.PageNumber,
                                                  contactQueryParameters.PageSize));
 }