Example #1
0
        public virtual ActionResult Index()
        {
            // NOTE: The user.JobSearch property must NOT be called until after the propogation process,
            //   otherwise the job search entity won't have the propogated milestone
            JobSearch search;

            // Make sure the user has a created job search
            var user = _serviceFactory.GetService<UserByIdQuery>().WithUserId(CurrentUserId).Execute();
            if (user.LastVisitedJobSearchId == null)
                return RedirectToAction(MVC.JobSearch.Add());

            // Update the job search's current milestone if required            
            var result = _jobsearchPropogationProcess.Execute(new JobSearchMilestonePropogationParams { JobSearchId = (int)user.LastVisitedJobSearchId });

            // If the job search's current milestone was updated, we need to reload the job search
            if (result.JobSearchMilestoneChanged)
                search = _serviceFactory.GetService<JobSearchByIdQuery>().WithJobSearchId((int)user.LastVisitedJobSearchId).Execute();
            else
                search = user.LastVisitedJobSearch;

            var model = new TaskDashboardViewModel(user);

            if (model.TodaysTasks.Count > 0)
                return View(MVC.Task.Views.Today, model);
            
            if (model.OverdueTasks.Count > 0)
                return View(MVC.Task.Views.Overdue, model);

            if (model.FutureTasks.Count > 0)
                return View(MVC.Task.Views.Future, model);

            // If no uncompleted tasks exist, go to the today view
            return View(MVC.Task.Views.Today, model);
        }
Example #2
0
        public virtual ActionResult Future()
        {
            var user = _serviceFactory.GetService<UserByIdQuery>().WithUserId(CurrentUserId).Execute();
            var model = new TaskDashboardViewModel(user);

            return View(model);
        }