forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrudServiceBase.cs
More file actions
42 lines (35 loc) · 1.01 KB
/
Copy pathCrudServiceBase.cs
File metadata and controls
42 lines (35 loc) · 1.01 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
using System.Collections.Generic;
using System.Threading.Tasks;
using L2dotNET.Repositories.Abstract;
using L2dotNET.Services.Contracts;
namespace L2dotNET.Services
{
public class CrudServiceBase<T> : ICrudService<T> where T : class
{
private readonly ICrudRepository<T> _crudRepository;
public CrudServiceBase(ICrudRepository<T> crudRepository)
{
_crudRepository = crudRepository;
}
public async Task<IEnumerable<T>> GetAll()
{
return await _crudRepository.GetAll();
}
public async Task<T> GetById(object id)
{
return await _crudRepository.GetById(id);
}
public async Task<int?> Add(T model)
{
return await _crudRepository.Add(model);
}
public async Task Update(T model)
{
await _crudRepository.Update(model);
}
public async Task Delete(T model)
{
await _crudRepository.Delete(model);
}
}
}