public async Task <IActionResult> Get() { try { var response = await _phoneBookService.Get().ConfigureAwait(false); return(Ok(response)); } catch (Exception ex) { _logger.Error(ex); return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public int Add(EntryModel model) { var entry = ToData.ToEntryData(model); int entryId = _entryRepo.Add(entry, _context).Id; var phoneBook = _pbService.Get(entry.PhoneBookId); if (phoneBook.Entries == null) { phoneBook.Entries = new List <Entry>(); } phoneBook.Entries.Add(entry); _pbService.Update(phoneBook); return(entryId); }
public ActionResult <PhoneBookOutDTO> Get(int id) { var result = _phoneBookService.Get(id); return(result); }