-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBookRepository.cs
More file actions
46 lines (40 loc) · 1.09 KB
/
Copy pathBookRepository.cs
File metadata and controls
46 lines (40 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using UnitTestingDemo.Data.Contexts;
using UnitTestingDemo.Data.EntityModels;
using UnitTestingDemo.Data.Interfaces;
namespace UnitTestingDemo.Data
{
public class BookRepository : IBookRepository
{
private readonly BookContext _bookContext;
public BookRepository(BookContext bookContext)
{
_bookContext = bookContext;
}
public IList<BookEntity> GetAll()
{
return _bookContext
.Books
.Include(b=>b.Author)
.ToList();
}
public BookEntity GetById(int id)
{
return _bookContext
.Books
.Include(b => b.Author)
.FirstOrDefault(x => x.Id == id);
}
public void Save(BookEntity saveThis)
{
throw new NotImplementedException();
}
public void Delete(BookEntity deleteThis)
{
throw new NotImplementedException();
}
}
}