33 lines
707 B
C#
33 lines
707 B
C#
using PetCompanion.Data;
|
|
using PetCompanion.Models;
|
|
|
|
namespace PetCompanion.Repositories
|
|
{
|
|
public class GameItemsRepository
|
|
{
|
|
private readonly ApplicationDbContext _context;
|
|
|
|
public GameItemsRepository(ApplicationDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public GameItem GetById(int id)
|
|
{
|
|
return _context.GameItems.Find(id);
|
|
}
|
|
|
|
public void Add(GameItem item)
|
|
{
|
|
_context.GameItems.Add(item);
|
|
_context.SaveChanges();
|
|
}
|
|
|
|
public void Update(GameItem item)
|
|
{
|
|
_context.GameItems.Update(item);
|
|
_context.SaveChanges();
|
|
}
|
|
}
|
|
}
|