using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Transactions; using System; using Church.Net.DAL.EF; using System.Linq; using Church.Net.Utility; using System.Threading.Tasks; using WebAPI.Logics.Interface; using Church.Net.DAL.EFCoreDBF; namespace WebAPI.Logics.Core { public class LogicBase : ICrudLogic where T : class, Church.Net.Entity.Interface.IEntity, new() { private readonly LogicService logicService; private readonly ICrudDAL crudDAL; public LogicBase( LogicService logicService, ICrudDAL crudDAL ) { this.logicService = logicService; this.crudDAL = crudDAL; } public virtual bool CheckExist(T obj) { return this.crudDAL.CheckExist(obj); } public virtual int Create(T entity) { return this.crudDAL.Create(entity); } public virtual Task CreateAsync(T entity) { return this.crudDAL.CreateAsync(entity); } public void CreateDone(T entity) { } public int CreateOrUpdate(T entity, out string id) { var result= this.crudDAL.CreateOrUpdate(entity, out string _id); id = _id; return result; } public string CreateReturnId(T entity) { return this.crudDAL.CreateReturnId(entity); } public int Delete(T obj) { return this.crudDAL.Delete(obj); } public int Delete(Func filter = null) { return this.crudDAL.Delete(filter); } public T First(Func filter = null) { return this.crudDAL.First(filter); } public IEnumerable GetAll(Func filter = null) { return this.crudDAL.GetAll(filter); } public IEnumerable GetAllById(IEnumerable Ids) { return this.crudDAL.GetAllById(Ids); } public T GetById(string Id) { return this.crudDAL.GetById(Id); } public int Update(T entity) { return this.crudDAL.Update(entity); } public void UpdateDone(T entity) { } public int UpdateRange(IEnumerable entities) { return this.crudDAL.UpdateRange(entities); } } }