-
Notifications
You must be signed in to change notification settings - Fork 1
/
LiteDBServices.cs
53 lines (40 loc) · 1.2 KB
/
LiteDBServices.cs
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
47
48
49
50
51
52
53
using System.Collections.Generic;
using LiteDB_Example.Common;
using LiteDB_Example.Models;
using LiteDB;
namespace LiteDB_Example.Services
{
public class LiteDBServices : ILiteDBServices
{
private readonly ILiteDBContext _context;
public LiteDBServices(ILiteDBContext context)
{
_context = context;
}
public BsonValue InsertCustomer(Customer customer)
{
var bsonValue = _context.InsertCustomer(customer);
return bsonValue;
}
public IEnumerable<Customer> GetAllCustomers()
{
var customers = _context.GetAllCustomers();
return customers;
}
public Customer GetCustomerById(int customerId)
{
var customer = _context.GetCustomerById(customerId);
return customer;
}
public bool UpdateCustomer(Customer customer)
{
var hasUpdated = _context.UpdateCustomer(customer);
return hasUpdated;
}
public bool DeleteCustomerById(int customerId)
{
var hasDeleted = _context.DeleteCustomerById(customerId);
return hasDeleted;
}
}
}