Test WPF Desktop App with Caliburn And RestSharp

This commit is contained in:
2019-02-26 01:26:03 +01:00
parent 35bd2890ed
commit e8fd116eab
38 changed files with 996 additions and 30 deletions

View File

@@ -6,34 +6,37 @@ using Microsoft.EntityFrameworkCore;
namespace LaDOSE.Business.Service
{
public class BaseService<T> : IBaseService<T> where T : class
public class BaseService<T> : IBaseService<T> where T : class
{
protected LaDOSEDbContext _context;
public BaseService(LaDOSEDbContext context)
{
this._context = context;
_context = context;
}
public virtual IEnumerable<T> GetAll()
{
return _context.Set<T>().ToList();
}
public virtual T GetById(int id)
{
return _context.Find<T>(id);
}
public virtual T Create(T entity)
{
var added = _context.Add(entity);
return added.Entity;
}
public virtual bool Update(T entity)
{
var entityEntry = _context.Update(entity);
return _context.Entry(entityEntry).State == EntityState.Unchanged;
}
public virtual bool Delete(int id)
{
var find = _context.Find<T>(id);