public ActionResult Detail(int?id) { try { if (User.Identity.IsAuthenticated) { if (id.HasValue) { try { if (_convertService.CheckIfActivitySummeryIdBelongsToUser(User.Identity.GetUserId(), (int)id)) { return(View("Details", _convertService.GetActivityViewModel((int)id))); } else { TempData["errorMessage"] = "You tried to access a activity that you don't own"; return(RedirectToAction("index")); } } catch (Exception) { TempData["ErrorMessage"] = "Something went wrong when trying to show the specific activity"; return(RedirectToAction("Index")); } } else { TempData["ErrorMessage"] = "Something went wrong when trying to show a specific activity, try again!"; return(RedirectToAction("Index")); } } else { return(RedirectToAction("Login", "Account")); } } catch (Exception) { return(View("Error")); } }