コード例 #1
0
        public RedirectToRouteResult UsersProfiles(Guid id, string Profile_FirstName, string Profile_LastName,
                                                   string Profile_Position, string Profile_Phone, string Profile_Fax,
                                                   string Profile_Culture, int Profile_PageSize, int Profile_MainScreenHeight)
        {
            var           user    = _userService.Get(id);
            ProfileCommon profile = ProfileCommon.GetProfile(user.UserName);

            if (ModelState.IsValid)
            {
                try
                {
                    profile.FirstName        = Profile_FirstName;
                    profile.LastName         = Profile_LastName;
                    profile.Position         = Profile_Position;
                    profile.Phone            = Profile_Phone;
                    profile.Fax              = Profile_Fax;
                    profile.Culture          = Profile_Culture == "-" ? "" : Profile_Culture.Trim();
                    profile.PageSize         = Profile_PageSize;
                    profile.MainScreenHeight = Profile_MainScreenHeight;
                    profile.Save();

                    TempData.AddInfo(Resources.Messages.SaveSuccess);
                    if (user.UserName == HttpContext.User.Identity.Name)
                    {
                        //Globals.ReadProfileToGlobals(user.UserName, true);
                        ProfileRepository.ClearCurrentProfile();
                    }
                    return(RedirectToAction("UsersProfiles", new { id }));
                }
                catch (Exception ex)
                {
                    TempData.AddError(Resources.Messages.SaveError + ex.ExMessage());
                }
            }
            return(RedirectToAction("UsersProfiles", new { id }));
        }