public ActionResult Index()
        {
            var leftJoin  = LINQExamplesService.LeftJoin().ToList();
            var rightJoin = LINQExamplesService.RightJoin().ToList(); // switch round the join order and use the same DefaultIfEmpty()

            var groupByQuery  = LINQExamplesService.GroupByQuery().ToList();
            var groupByLambda = LINQExamplesService.GroupByLambda().ToList();

            SchoolContext _ctx = new SchoolContext();

            // GetByID uses .Find() gets from Context if there already else the DB
            School sc1 = _unitOfWork.Repository <School>().GetByID(1);

            sc1.Name = "Bromley High";

            _unitOfWork.Save();

            return(View());
        }
Ejemplo n.º 2
0
 public BaseController()
 {
     _unitOfWork         = new UnitOfWork(new SchoolContext());
     StudentService      = new StudentService(_unitOfWork);
     LINQExamplesService = new LINQExamplesService(_unitOfWork);
 }
 public BaseController()
 {
     _unitOfWork = new UnitOfWork(new SchoolContext());
     StudentService = new StudentService(_unitOfWork);
     LINQExamplesService = new LINQExamplesService(_unitOfWork);
 }