Beispiel #1
0
        public IActionResult Index()
        {
            if (!service.IsWorker())
            {
                return(Redirect("/"));
            }
            User          user          = service.GetCurrentUser();
            WorkerAccount workerAccount = service.GetWorkerAccount();

            if (!service.HasActiveJobs())
            {
                ViewData["Jobs"] = "<h2>You have no active jobs!</h2>";
                return(View());
            }
            StringBuilder stringBuilder = new StringBuilder();

            foreach (var job in service.ActiveJobs())
            {
                stringBuilder.AppendLine("<li>");
                stringBuilder.AppendLine("<a href=\"/WorkerActiveJob/Index/" + job.Id + "\">" + job.Name + "</a>");
                stringBuilder.AppendLine("</li>");
            }
            ViewData["Jobs"] = stringBuilder.ToString();

            return(View());
        }
Beispiel #2
0
        public IActionResult Index()
        {
            ListWorkerJobsViewModel model = new ListWorkerJobsViewModel();

            if (!service.IsWorker())
            {
                return(Redirect("/"));
            }
            User          user          = service.GetCurrentUser();
            WorkerAccount workerAccount = service.GetWorkerAccount();

            model.AnyActiveJobs = service.HasActiveJobs();
            if (!model.AnyActiveJobs)
            {
                return(View(model));
            }
            model.ActiveJobs = service.ActiveJobs();
            return(View(model));
        }