Example #1
0
        public ActionResult Index()
        {
            var model = new ToDoModel();

            Employee currentUser = _session.GetCurrentUser();
            var assignedSpecification = new SearchSpecification();
            assignedSpecification.MatchApprover(currentUser);
            assignedSpecification.MatchStatus(ExpenseReportStatus.Submitted);
            ExpenseReport[] assigned = _repository.GetMany(assignedSpecification);
            model.Submitted = assigned;

            var inProgressSpecification = new SearchSpecification();
            inProgressSpecification.MatchApprover(currentUser);
            inProgressSpecification.MatchStatus(ExpenseReportStatus.Approved);
            ExpenseReport[] inProgress = _repository.GetMany(inProgressSpecification);
            model.Approved = inProgress;

            return PartialView(model);
        }
        public ActionResult Index()
        {
            var model = new ToDoModel();

            Employee currentUser = _session.GetCurrentUser();
            var submittedSpecification = new ExpenseReportSpecificationQuery
            {
                Approver = currentUser,
                Status = ExpenseReportStatus.Submitted
            };
            ExpenseReport[] submitted = _bus.Send(submittedSpecification).Results;
            model.Submitted = submitted;

            var approvedSpecification = new ExpenseReportSpecificationQuery
            {
                Approver = currentUser,
                Status = ExpenseReportStatus.Approved
            };
            ExpenseReport[] approved = _bus.Send(approvedSpecification).Results;
            model.Approved = approved;

            return PartialView(model);
        }