コード例 #1
0
        public void RefreshUserCity(CityModel model)
        {
            if (AppUser != null)
            {
                MyService.AddOrModifyCurrentCityForProfile(AppUser.Profiles[OldHouseUserProfile.PROFILENBAME], model.currentCity);
                MyService.AddOrModifyCurrentProvinceForProfile(AppUser.Profiles[OldHouseUserProfile.PROFILENBAME], model.currentProvince);
            }
            //var cookie = new HttpCookie("citygee-currentprovince");
            //cookie.Value = model.currentProvince;
            //cookie.Expires = DateTime.Now.AddDays(7);
            //HttpContext.Current.Response.Cookies.Add(cookie);
            //cookie = new HttpCookie("citygee-currentcity");
            //cookie.Value = model.currentCity;
            //cookie.Expires = DateTime.Now.AddDays(7);
            //HttpContext.Current.Response.Cookies.Add(cookie);

            //HttpCookie cookie = new HttpCookie("citygee-currentcity", model.currentCity);
            //cookie.Expires = DateTime.Now.AddDays(1);
            //HttpContext.Current.Response.AppendCookie(cookie);
        }
コード例 #2
0
        public ActionResult ModifyProfile(UserProfileDto model)
        {
            if (ModelState.IsValid)
            {
                AppUser.UserName = model.UserName;
                AppUser.NickName = model.NickName;
                AppUser.sex      = model.Sex;
                MyService.MyUserManager.UserRepository.SaveOne(AppUser);
                MyService.AddOrModifyCurrentProvinceForProfile(AppUser.Profiles[OldHouseUserProfile.PROFILENBAME], model.ProfileProvince);
                MyService.AddOrModifyCurrentCityForProfile(AppUser.Profiles[OldHouseUserProfile.PROFILENBAME], model.ProfileCity);
                ViewBag.Information = "资料修改成功!";
            }
            UserInformationDto user = Mapper.Map <UserInformationDto>(AppUser);

            user.Who            = "我";
            ViewBag.Title       = "个人设置";
            ViewBag.Visitor     = user;
            ViewBag.UserProfile = model;
            return(View("Setting"));
        }