public Book SaveBook(RegBook book) { return(repo.Transaction(() => { Category category = Category.FindById(repo, book.CategoryId); Format format = Format.FindById(repo, book.FormatId); Book entity = book.create(); if (category != null && format != null) { entity.Category = category; entity.Format = format; entity.Save(repo); return entity; } return null; })); }
public Book SaveBook([FromBody] RegBook book) { return(service.SaveBook(book)); }