31 lines
802 B
C#
31 lines
802 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Portfolio.Domain.Features.Pokemon;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Portfolio.Infrastructure.Repositories
|
|
{
|
|
public class PokemonRepository : IPokemonRepository
|
|
{
|
|
private readonly ApplicationDbContext _context;
|
|
|
|
public PokemonRepository(ApplicationDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<List<Pokemon>> GetAllPokemonsAsync()
|
|
{
|
|
return await _context.Pokemons.ToListAsync();
|
|
}
|
|
public async Task AddPokemonAsync(Pokemon pokemon)
|
|
{
|
|
_context.Pokemons.Add(pokemon);
|
|
await _context.SaveChangesAsync();
|
|
}
|
|
}
|
|
}
|