Skip to content

Instantly share code, notes, and snippets.

@evgomes
Created February 4, 2019 22:52
Show Gist options
  • Save evgomes/17cb4c67cf50b03a02a781fb1080683b to your computer and use it in GitHub Desktop.
Save evgomes/17cb4c67cf50b03a02a781fb1080683b to your computer and use it in GitHub Desktop.
ProductRepository of Supermarket API
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Supermarket.API.Domain.Models;
using Supermarket.API.Domain.Repositories;
using Supermarket.API.Persistence.Contexts;
namespace Supermarket.API.Persistence.Repositories
{
public class ProductRepository : BaseRepository, IProductRepository
{
public ProductRepository(AppDbContext context) : base(context)
{
}
public async Task<IEnumerable<Product>> ListAsync()
{
return await _context.Products.Include(p => p.Category)
.ToListAsync();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment