public Book UpdateBook(ChgBook book)
        {
            return(repo.Transaction(() =>
            {
                Book entity = Book.FindById(repo, book.Id);

                if (entity != null)
                {
                    entity.Title = book.Title;
                    entity.Isbn = book.Isbn;

                    Category category = Category.FindById(repo, book.CategoryId);
                    Format format = Format.FindById(repo, book.FormatId);

                    if (category != null && format != null)
                    {
                        entity.Category = category;
                        entity.Format = format;
                        entity.Update(repo);
                        return entity;
                    }
                    return null;
                }
                return null;
            }));
        }
 public Book DeleteBook(ChgBook book)
 {
     return(repo.Transaction(() =>
     {
         Book entity = Book.FindById(repo, book.Id);
         if (entity != null)
         {
             entity.Delete(repo);
             return entity;
         }
         return null;
     }));
 }
 public Book DeleteBook([FromBody] ChgBook book)
 {
     return(service.DeleteBook(book));
 }
 public Book EditBook([FromBody] ChgBook book)
 {
     return(service.UpdateBook(book));
 }