Skip to content

Instantly share code, notes, and snippets.

@evgomes
Created January 30, 2019 15:41
Show Gist options
  • Save evgomes/d0ea98d8a16b5b2a4b7fe35ac6b6549a to your computer and use it in GitHub Desktop.
Save evgomes/d0ea98d8a16b5b2a4b7fe35ac6b6549a to your computer and use it in GitHub Desktop.
CategoryRepository with AddAsync method, from Supermarket API
public class CategoryRepository : BaseRepository, ICategoryRepository
{
public CategoryRepository(AppDbContext context) : base(context)
{ }
public async Task<IEnumerable<Category>> ListAsync()
{
return await _context.Categories.ToListAsync();
}
public async Task AddAsync(Category category)
{
await _context.Categories.AddAsync(category);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment