public async Task <IActionResult> Create(BookDto book) { var user = User; if (ModelState.IsValid) { var status = await _booksService.CreateAsync(book.ToDomainModel()); if (status) { return(Ok()); } else { ModelState.AddModelError("", "Book with same title already exists"); } } return(BadRequest(ModelState)); }
public async Task <IActionResult> Create(BookDto bookDto) { await booksService.CreateAsync(bookDto); return(Ok()); }
public async Task <int> CreateAsync(int authorId, string title, string description, decimal price, int copies, int?edition, int?ageRestriction, DateTime releaseDate, string categories) { return(await _booksService.CreateAsync(authorId, title, description, price, copies, edition, ageRestriction, releaseDate, categories)); }