public async Task <ActionResult <AddressBook> > GetAddressBook(int addressId) { if (addressId == 0) { return(BadRequest()); } try { var result = CacheManager <List <AddressBook> > .Get(_memoryCache, cacheKey); if (result == null || result.Count == 0) { var address = await _addressBookRepository.GetAddressBook(addressId); if (address == null) { return(NotFound()); } return(Ok(address)); } var item = result.FirstOrDefault(s => s.AddressBookId == addressId); return(Ok(item)); } catch (Exception) { return(BadRequest()); } }
//[Authorize] // GET: api/People/5 public AddressBook Get(int id) { AddressBook person = _addressBookRepository.GetAddressBook(id); return(person); }