Update API

This commit is contained in:
Chris Chen
2022-09-30 09:40:42 -07:00
parent 184db15773
commit b33c0d8286
55 changed files with 3877 additions and 360 deletions
+12 -12
View File
@@ -13,8 +13,8 @@ namespace WebAPI.Logics.Core
{
public class LogicBase<T> : ICrudLogic<T> where T : class, Church.Net.Entity.Interface.IEntity, new()
{
private readonly LogicService logicService;
private readonly ICrudDAL<T> crudDAL;
protected readonly LogicService logicService;
protected readonly ICrudDAL<T> crudDAL;
public LogicBase(
LogicService logicService,
@@ -46,15 +46,15 @@ namespace WebAPI.Logics.Core
public int CreateOrUpdate(T entity, out string id)
{
var result= this.crudDAL.CreateOrUpdate(entity, out string _id);
id = _id;
var result= this.crudDAL.CreateOrUpdate(entity);
id = entity.Id;
return result;
}
public string CreateReturnId(T entity)
{
return this.crudDAL.CreateReturnId(entity);
}
//public string CreateReturnId(T entity)
//{
// return this.crudDAL.CreateReturnId(entity);
//}
public int Delete(T obj)
{
@@ -75,10 +75,10 @@ namespace WebAPI.Logics.Core
return this.crudDAL.GetAll(filter);
}
public IEnumerable<T> GetAllById(IEnumerable<string> Ids)
{
return this.crudDAL.GetAllById(Ids);
}
//public IEnumerable<T> GetAllById(IEnumerable<string> Ids)
//{
// return this.crudDAL.GetAllById(Ids);
//}
public T GetById(string Id)
{
+20 -3
View File
@@ -1,16 +1,33 @@
using Church.Net.DAL.EF;
using Microsoft.Extensions.DependencyInjection;
using WebAPI.Services;
namespace WebAPI.Logics.Core
{
public class LogicService
{
private readonly IServiceScopeFactory serviceScopeFactory;
public LogicService(
ChurchNetContext dbContext
//ChurchNetContext dbContext
IServiceScopeFactory serviceScopeFactory
)
{
DbContext = dbContext;
this.serviceScopeFactory = serviceScopeFactory;
//DbContext = dbContext;
}
public ChurchNetContext DbContext { get; }
//public ChurchNetContext DbContext { get; }
public string CurrentUserId
{
get
{
using (var scope = serviceScopeFactory.CreateScope())
{
var service = scope.ServiceProvider.GetService<IdentityService>();
return service.UserId;
}
}
}
}
}