public async Task <IActionResult> Post([FromBody] BookCategoryDto bookCategoryDto) { await _bookCategoryService.SaveBookCategory(bookCategoryDto); var bookCategories = await _bookCategoryService.GetAllBookCategory(); return(Ok(bookCategories)); }
public async Task <bool> SaveBookCategory(BookCategoryDto bookCategoryDto) { var bookCategory = Mapper.Map <BookCategoryDto, BookCategory>(bookCategoryDto); await _unitOfWork.BookCategories.Add(bookCategory); await _unitOfWork.SaveChanges(); return(true); }
public async Task <ActionResult <ApiResponse> > Put(int id, [FromBody] BookCategoryDto entity) { return(new ApiResponse($"The record with {id} was updated.", await bookCategoryService.Update(id, mapper.Map <BookCategory>(entity)))); }
public async Task <ActionResult <ApiResponse> > Post([FromBody] BookCategoryDto entity) { return(new ApiResponse("New book category added.", await bookCategoryService.Add(mapper.Map <BookCategory>(entity)))); }