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); }
public ActionResult <List <PhoneBook> > Get() { return(Ok(_pbService.GetAll())); }