using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using PagedList; namespace Church.Net.BLL.Core { public class BussinessLogicBase : IBussinessLogic where T : class { DAL.Core.IRepository DAL { get; set; } public BussinessLogicBase(string connString) { DAL = new RepositoryBase(connString); } public void Add(T obj) { DAL.Add(obj); } public void Edit(T obj) { DAL.Edit(obj); } public void Delete(T obj) { DAL.Delete(obj); } public void Delete(string id) { throw new NotImplementedException(); } public T GetSingle(Expression> whereCondition) { return DAL.GetSingle(whereCondition); } public PagedList GetPagedList(int page, int itemPerPage) { var list = DAL.GetQueryable().Skip(page - 1).Take(itemPerPage); PagedList result = new PagedList(list,page, itemPerPage); return result; } public PagedList GetPagedList(int page, int itemPerPage,Expression> whereCondition) { throw new NotImplementedException(); } public PagedList GetPagedList(int page, int itemPerPage, Expression> whereCondition, Expression> orderCondition) { var list = DAL.GetQueryable(whereCondition).OrderBy(orderCondition).Skip(page - 1).Take(itemPerPage); throw new NotImplementedException(); } public IList GetAll() { throw new NotImplementedException(); } public IList GetAll(Expression> whereCondition) { var list = DAL.GetQueryable(whereCondition); return list.ToList(); } } }