public IActionResult OnGet(int?caseId, int?dropCaseId, int?completeCaseId, int?deleteContactId, int?manualMarkContactId, int?manualUnmarkContactId)
        {
            var claims      = HttpContext.User.Claims;
            var currentUser = userService.GetUserByUserName(claims.Single(x => x.Type == "preferred_username").Value, int.Parse(claims.Single(x => x.Type == "usrtype").Value));

            if (dropCaseId != null && CaseListItems.AssignedCases.Any(x => x.CaseID == dropCaseId))
            {
                caseService.Drop(dropCaseId.Value, currentUser.UserId);
                return(new RedirectToPageResult("Dashboard"));
            }
            if (completeCaseId != null && CaseListItems.AssignedCases.Any(x => x.CaseID == completeCaseId))
            {
                var completeResult = caseService.Complete(completeCaseId.Value, currentUser.UserId);
                if (completeResult)
                {
                    return(new RedirectToPageResult("Dashboard"));
                }
                else
                {
                    CloseFailed = true;
                }
            }

            if (manualMarkContactId.HasValue)
            {
                var manualMarkContact = contactService.GetContact(manualMarkContactId.Value);
                if (manualMarkContact != null && CaseListItems.AssignedCases.Any(x => x.CaseID == manualMarkContact.CaseID))
                {
                    if (manualMarkContact.ContactedDate == null)
                    {
                        manualMarkContact.ContactedDate = DateTime.Now;
                    }
                    contactService.Update(manualMarkContact);
                }
            }
            if (manualUnmarkContactId.HasValue)
            {
                var manualUnmarkContact = contactService.GetContact(manualUnmarkContactId.Value);
                if (manualUnmarkContact != null && CaseListItems.AssignedCases.Any(x => x.CaseID == manualUnmarkContact.CaseID))
                {
                    manualUnmarkContact.ContactedDate = null;
                    contactService.Update(manualUnmarkContact);
                }
            }

            if (caseId.HasValue && !CaseListItems.AssignedCases.Any(x => x.CaseID == caseId))
            {
                return(Unauthorized());
            }


            if (caseId.HasValue)
            {
                if (deleteContactId.HasValue)
                {
                    var deleteContact = contactService.GetContact(deleteContactId.Value);
                    if (deleteContact != null && CaseListItems.AssignedCases.Any(x => x.CaseID == deleteContact.CaseID))
                    {
                        contactService.Delete(deleteContact.ContactID);
                    }
                }
                CaseListItems.AssignedCases.FirstOrDefault(x => x.CaseID == caseId).IsActive = true;

                var currentCase = caseService.GetCase(caseId.Value);
                if (currentCase != null)
                {
                    CurrentAssignedCase = new CaseDetail
                    {
                        Name         = currentCase.GetFullName(),
                        CaseID       = currentCase.CaseID,
                        contacts     = caseService.GetTracedContacts(currentCase.CaseID).Select(MapToContactDetail).OrderBy(x => x.DateTraced),
                        EmailAddress = currentCase.Email,
                        PhoneNumber  = currentCase.Phone,
                        PhoneNumber2 = currentCase.Phone2
                    };
                }
            }

            return(Page());
        }