Exemplo n.º 1
0
        private ActionResult GetUserPage(string UserNameOrId)
        {
            ErrorRedirectViewData UserError = new ErrorRedirectViewData
            {
                DelaySeconds = 5,
                RedirectUrl  = Url.Action("Index", "Home"),// "/Projets/Liste",
                ErrorMsg     = "Cet utilisateur n'existe pas."
            };

            try
            {
                IUserProfile user = Data.UserDataAccess.GetUser(new Guid(UserNameOrId));

                if (user == null)
                {
                    user = Data.UserDataAccess.GetUser(UserNameOrId);
                }
                if (user == null)
                {
                    return(View("ErrorRedirect", UserError));
                }
                SetPageTitle("Profil de " + user.UserName);
                return(View(user));
            }
            catch (Exception ex)
            {
                return(View("ErrorRedirect", UserError));
            }
        }
Exemplo n.º 2
0
        protected ActionResult ErrorRedirect(string errormsg, int delayseconds, string redirectUrl)
        {
            ErrorRedirectViewData errorViewData = new ErrorRedirectViewData()
            {
                DelaySeconds = delayseconds,
                ErrorMsg     = errormsg,
                RedirectUrl  = redirectUrl
            };

            return(View("ErrorRedirect", errorViewData));
        }