Exemplo n.º 1
0
        public List <PhonebookDto> GetAllContacts()
        {
            List <PhonebookDto> contacts = new List <PhonebookDto>();

            var anyRecords = _PhoneBookService.GetAll().Count() != 0;

            if (anyRecords)
            {
                contacts = (from c in _PhoneBookService.GetAll()
                            select new PhonebookDto
                {
                    Id = Convert.ToInt32(c.Id),
                    Name = c.Name,
                    Surname = c.Surname,
                    CreatedDate = c.CreatedDate
                }).ToList();
            }

            return(contacts);
        }
Exemplo n.º 2
0
 public ActionResult <List <PhoneBook> > Get()
 {
     return(Ok(_pbService.GetAll()));
 }