public ActionResult DetailsByDept(DepartmentM dept)
        {
            var svc   = CreateManagerService();
            var model = svc.GetManagersByDept(dept);

            return(View(model));
        }
Beispiel #2
0
 public IEnumerable <ManagerDetail> GetManagersByDept(DepartmentM dept)
 {
     using (var ctx = new ApplicationDbContext())
     {
         var query =
             ctx
             .Managers
             .Where(e => e.DeptM == dept)
             .Select(e => new ManagerDetail
         {
             ManagerId        = e.ManagerId,
             ManagerFirstName = e.ManagerFirstName,
             ManagerLastName  = e.ManagerLastName,
             HiredDate        = e.HiredDate,
             DeptM            = e.DeptM,
         });
         return(query.ToArray());
     }
 }