public async Task <ActionResult <List <Category> > > Get([FromServices] BooksApiContext booksApiContext) { try { Service = new CategoryService(booksApiContext); return(await Service.GetCategoriesAsync()); } catch (Exception e) { return(BadRequest(new { status = "error", message = e.Message })); } }
public async Task <ActionResult <Category> > Post([FromServices] BooksApiContext booksApiContext, [FromBody] Category category) { try { Service = new CategoryService(booksApiContext); if (ModelState.IsValid) { return(await Service.PostAsync(category)); } else { return(BadRequest(ModelState)); } } catch (Exception e) { return(BadRequest(new { status = "error", message = e.Message, detail = e.InnerException.Message })); } }
public PublishersController(BooksApiContext context) { _context = context; }
public GenericRepository(BooksApiContext context) { _context = context; _dbSet = _context.Set <TEntity>(); }
public CategoryService(BooksApiContext context) { _Context = context; }
public BooksController(BooksApiContext context) { _context = context; }
public UserService(BooksApiContext context) { _Context = context; }
public UnitOfWork(BooksApiContext context) { _context = context; }