public ActionResult Issue(int workId, int page) {
     var mod = new WorkViewModel() {
         Work = dbContext.Works.FirstOrDefault(w => w.WorkId == workId),
         Page = page
     };
     return View(mod);
 }
 public ActionResult PrintView(int issueId, int workId) {
     var mod = new WorkViewModel() {
         Work = dbContext.Works.FirstOrDefault(w => w.WorkId == workId),
         Page = 0
     };
     return View(mod);
 }
        public ActionResult Work(int issueId, int workId, int page) {
            bool workFound = false;

            //adding in special clause to redirect issueid 42 to the next issue
            if (issueId != 42) {
                //make sure the issue is active
                Issue i = issues.GetIssue(issueId);

                //verify an issue exists with that id, it is completed (or we are in debug), and it contains the work id parameter
                if (i != null && (i.Completed || AppConfig.InDebug) && i.Works.Count(x => x.WorkId == workId) > 0) {
                    workFound = true;
                }
            } else {
                //special testing mode
                if(issues.GetAllIssues().FindAll(x => !x.Completed).OrderBy(x => x.ReleaseDate).Count() > 0) workFound = true;
            }

            if (workFound) {
                var model = new WorkViewModel() {
                    Work = dbContext.Works.FirstOrDefault(w => w.WorkId == workId),
                    Page = page
                };

                //manaully reassign the issue id in case the special debug code of 42 was used. this will ensure links use the proper address
                model.Work.Issue.IssueId = issueId;
                return View(model);
            } else
                //the work wasn't found, send the user a 404
                return RedirectToRoute(new { action = "Http404", controller = "Errors" });
        }