27 lines
501 B
C#
27 lines
501 B
C#
using System;
|
|
using System.Linq;
|
|
using Domain;
|
|
|
|
namespace Infrastructure.Repositories.EntityFramework
|
|
{
|
|
public class LinkRepository : ILinkRepository
|
|
{
|
|
private readonly HNDbContext _context;
|
|
|
|
public LinkRepository(HNDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public void Add(Link link)
|
|
{
|
|
_context.Links.Add(link);
|
|
_context.SaveChanges();
|
|
}
|
|
|
|
public Link GetById(Guid id)
|
|
{
|
|
return _context.Links.Single(link => link.Id == id);
|
|
}
|
|
}
|
|
} |