/// <summary> /// Gets a wrapper class for editing a specific user that is /// retrieved by its primary key. /// </summary> /// <param name="id">Primary key for the user to edit</param> /// <returns>A view with the wrapper class for editing users</returns> public ActionResult EditUser(int id) { try { #region IsAdminCheck if (Session["Kunde"] == null) { return(RedirectToAction("Frontpage", "Film")); } var user = (UserVM)Session["Kunde"]; int userId = user.Id; if (!_UserLogic.IsAdmin(userId)) { return(RedirectToAction("Frontpage", "Film")); } #endregion IsAdminCheck EditUserVM userEdited = _UserLogic.GetEditUser(id); return(View(userEdited)); } catch (DatabaseErrorException e) { TempData["message"] = "Databasefeil. Se errorlog."; TempData["errormessage"] = e.GetMessage(); return(RedirectToAction("AdminFrontPage")); } }