I'm still confusing in what should be coded in data layer and in business layer. because some of method can implemented in both of theme. for example I want the Employs between two date or somethings like this. so should I do that in BL or in AL.
namespace DataLayer
{
public class EmployeRepository : IEmployeRepository
{
public List<Employe> GetList()
{
using (ADON3Entities db = new ADON3Entities())
{
return db.Employes.ToList();
}
}
public List<Employe> GetEmploysBetweenDates(DateTime start, DateTime end)
{
using (ADON3Entities db = new ADON3Entities())
{
return db.Employes.Where(em => em.NaissEmploye >= start && em.NaissEmploye <= end).ToList();
}
}
}
}
or I should doing that like this:
namespace BusinessLayer
{
public static class EmployeServices
{
static IEmployeRepository repository;
static EmployeServices()
{
repository = new EmployeRepository();
}
public static List<Employe> GetList()
{
return repository.GetList();
}
public static List<Employe> GetEmploysBetweenDates(DateTime start, DateTime end)
{
return repository.GetList().Where(em => em.NaissEmploye >= start && em.NaissEmploye <= end).ToList();
}
}
}
And thank in advanced for any help or reference to understand tree layer architecture!