Example #1
0
        public async Task <BooksModel> UpdateBook(BooksModel bookModel)
        {
            _context.Attach(bookModel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                return(bookModel);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookModelExists(bookModel.ID))
                {
                    return(bookModel);
                }
                else
                {
                    throw;
                }
            }
        }