Created
February 4, 2019 22:52
-
-
Save evgomes/17cb4c67cf50b03a02a781fb1080683b to your computer and use it in GitHub Desktop.
ProductRepository of Supermarket API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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