public IActionResult GetAllContacts(int page = 1, int pageSize = 4)
        {
            try
            {
                var contacts = _contactsService.GetAllContacts().OrderBy(x => x.ContactId);

                // Paging information is in header - Response is Data Only, Metadata is in header
                pageSize = AddMetaDataToHeader(page, pageSize, contacts);

                return(Ok(contacts.Skip(pageSize * (page - 1)).Take(pageSize)));
            }
            catch (Exception ex)
            {
                log.Error("PublicAddressBookApiError: ", ex);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Example #2
0
        /// <summary>
        /// Fetch the list of all the Contacts
        /// </summary>
        /// <returns>List<ContactModel></returns>
        public List <ContactModel> GetAllContacts()
        {
            List <ContactDO> contactDetailsDOList = _iContacts.GetAllContacts();

            return(Mapper.Mapper.MapToContactModelList(contactDetailsDOList));
        }
Example #3
0
 public IEnumerable <Contact> GetAllContacts(IContacts acc)
 {
     return(acc.GetAllContacts());
 }