Test WPF Desktop App with Caliburn And RestSharp
This commit is contained in:
10
LaDOSE.Src/LaDOSE.Service/Interface/IWordPressService.cs
Normal file
10
LaDOSE.Src/LaDOSE.Service/Interface/IWordPressService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
|
||||
namespace LaDOSE.Business.Interface
|
||||
{
|
||||
public interface IWordPressService
|
||||
{
|
||||
List<WPEvent> GetWpEvent();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
22
LaDOSE.Src/LaDOSE.Service/Service/WordPressService.cs
Normal file
22
LaDOSE.Src/LaDOSE.Service/Service/WordPressService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LaDOSE.Business.Interface;
|
||||
using LaDOSE.Entity.Context;
|
||||
using LaDOSE.Entity.Wordpress;
|
||||
|
||||
namespace LaDOSE.Business.Service
|
||||
{
|
||||
public class WordPressService : IWordPressService
|
||||
{
|
||||
private LaDOSEDbContext _context;
|
||||
public WordPressService(LaDOSEDbContext context)
|
||||
{
|
||||
this._context = context;
|
||||
}
|
||||
|
||||
public List<WPEvent> GetWpEvent()
|
||||
{
|
||||
return _context.Set<WPEvent>().ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user