예제 #1
0
        public async Task <IActionResult> UpdateAddressBook([FromBody] AddressBook addressBook)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    bool result = await _addressBookRepository.UpdateAddressBook(addressBook).ConfigureAwait(false);

                    if (result)
                    {
                        CacheManager <List <AddressBook> > .Remove(_memoryCache, cacheKey);

                        return(Ok(result));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                catch (Exception)
                {
                    return(BadRequest());
                }
            }
            return(BadRequest());
        }
예제 #2
0
 //[Authorize]
 // PUT: api/People/5
 public void Put(int id, [FromBody] AddressBook addressBook)
 {
     _addressBookRepository.UpdateAddressBook(addressBook);
 }