Exemplo n.º 1
0
        public async Task <ActionResult <Product> > Get(long id)
        {
            using (var dbContext = _dbContextFactory.GetApplicationContext())
            {
                var product = await dbContext
                              .Set <Product>()
                              .FirstOrDefaultAsync(p => p.Id == id);

                if (product == null)
                {
                    return(NotFound());
                }
                return(product);
            }
        }