public async Task <ActionResult> Index(UserVModel user) { ModelState.CleanUp("FirtsName", "LastName"); if (ModelState.IsValid) { try { string originalPassword = user.Password; //Step 1 user.Password = Tools.GetHashedPassword(this.AppSettings, user.Password); //Step 2 var userLogin = await UserLogin(user.UserName, user.Password); if (null != userLogin) { base.CurrentUser = userLogin; return(RedirectToAction("Index", "Dashboard")); } } catch (DataValidationException dex) { this.ModelState.AddModelError(dex.PropertyName, dex.ErrorMessage); } } user.Password = string.Empty; return(View(user)); }
public ActionResult CreateEdit(string id) { string Title = string.Empty; var model = new UserVModel(); if (!string.IsNullOrEmpty(id)) { var user = UserManager.FindById(id); model.Profile = Context.UserProfileRepo.Get(s => s.Id == user.ProfileId.Value, includeProperties: "UserImage").FirstOrDefault(); model.Id = user.Id; model.UserName = user.UserName; model.ContactNumber = user.PhoneNumber; model.Status = user.Status ?? false; model.ProfileId = user.ProfileId.Value; model.Email = user.Email; model.EmailConfirmed = user.EmailConfirmed; model.Roles = UserManager.GetRoles(user.Id).ToArray(); } else { model.Profile = new UserProfile(); model.Profile.UserImage = new UserImage(); } model.SystemRoles = RoleManager.Roles.Select(s => s.Name).ToList(); return(View(model)); }
public ActionResult SetPassword(UserVModel user, string oldPassword) { if (string.IsNullOrEmpty(oldPassword) || !UserPublic.CheckUserPassword(user.Id, oldPassword)) { return(Json(new JsonResultModel { Message = "旧密码输入错误!" })); } ModelState.Remove("Name"); ModelState.Remove("NickName"); ModelState.Remove("Sex"); ModelState.Remove("RoleId"); ModelState.Remove("Avatar"); ModelState.Remove("Email"); if (!ModelState.IsValid) { return(Json(new JsonResultModel { Message = ModelStateHelper.GetAllErrorMessage(ModelState) })); } var status = UserPublic.UpdatePassword(user.Id, user.Password); return(Json(new JsonResultModel { ResultState = status, Message = status?"修改成功!":"修改失败!" })); }
public ApiMessage <object> LoginByToken(userinfo user) { var userData = _bll.LoginByToken(user); var outData = new ApiMessage <object> { Success = userData.Success, Msg = userData.Msg, MsgCode = userData.MsgCode }; if (!userData.Success) { return(outData); } var currentUser = UserVModel.FormatUser(userData.Data); var key = Encrypt.MD5(currentUser.Id + "_" + currentUser.UserType); outData.Data = new { Token = key, currentUser.UserName, currentUser.UserCode, currentUser.ImageUrl, currentUser.Id, currentUser.Phone, currentUser.IsMember, currentUser.PointAmount }; CacheHelper.SetCache(key, currentUser, new TimeSpan(0, 30, 0)); return(outData); }
private async Task <UserVModel> GetUserRoleListById(int userId) { UserVModel user = new UserVModel(); try { if (0 != userId) { user = _userRepository.GetQueryByUserId(userId); } if (null == user) { } else { user.UserRoleModelList = await _userRoleRepository.GetQueryUserRoleByUserId(user.UserID); } } catch (Exception ex) { throw; } return(user); }
public JsonResult saveUser(UserVModel user) { var exceptionMessage = "An unknown error occured :: "; try { if (string.IsNullOrEmpty(user.username) || string.IsNullOrEmpty(user.password) || string.IsNullOrEmpty(user.securityQuestion) || string.IsNullOrEmpty(user.securityAnswer)) { return(Json(new { error = true, message = "All fields are mandatory" }, JsonRequestBehavior.AllowGet)); } if (repo.AddUser(user)) { return(Json(new { error = false, message = "User has been created successfully" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { error = true, message = "There was an error creating user" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { var innerException = ex.InnerException != null ? ex.InnerException.Message : string.Empty; exceptionMessage = $"{exceptionMessage} {ex.Message } { innerException }"; } return(Json(new { error = true, message = exceptionMessage }, JsonRequestBehavior.AllowGet)); }
public async Task <bool> UpdateUserRole(UserVModel model) { return(await _userRoleRepository.UpdateUserRoleTODO(model)); //// Get current User //var user = _userRepository.GetItemByExpression(x=> x.UserName == model.UserName); //var equal = model.Equals(user); ////Valida si ya existe ese UserName //if (_userRepository.Exist(x=> x.UserName == model.UserName && x.UserID != model.UserID)) //{ // //if (userExtension.ID == user.ID) // //{ // // if (string.IsNullOrEmpty(userExtension.Password)) // // userExtension.Password = user.Password; // // user = null; // //} //} //else //{ // if (string.IsNullOrEmpty(model.Password)) // { // throw new DataValidationException("Password", "El password no puede ser vacio."); // } //} //if (null == user) //{ // return await _userRoleRepository.UpdateUserRoleTODO(model);// this.Repository.UpdateUserRole(userExtension); //} //else // throw new DataValidationException("UserName", "El usuario ya existe."); //return false; }
private async Task <UserVModel> UserLogin(string userName, string password) { var user = await Login(userName, password); if (null == user) { throw new DataValidationException("UserName", string.Format("El usuario {0} no existe.", userName)); } if (user.Password != password) { throw new DataValidationException("Password", "Contraseña invalida."); } if (1 != user.Status) { throw new DataValidationException("Email", string.Format("El usuario {0} no está activo.", userName)); } user.Password = string.Empty; UserVModel userV = JsonConvert.DeserializeObject <UserVModel>(JsonConvert.SerializeObject(user).ToString()); return(userV); }
/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="user"></param> /// <returns></returns> public static UserInfo UserVModelToInfo(UserVModel user) { if (user == null) { return(new UserInfo()); } return(new UserInfo { Id = user.Id, Name = user.Name, NickName = user.NickName, Password = user.Password, RoleId = user.RoleId, OnLineTime = user.OnLineTime, ActionTime = user.ActionTime, CreateTime = user.CreateTime, Avatar = user.Avatar, Sex = user.Sex, Email = user.Email, EmailStatus = user.EmailStatus, Score = user.Score, ArticleNum = user.ArticleNum, CommentNum = user.CommentNum, Disable = user.Disable, DisableReason = user.DisableReason, QQ = user.QQ }); }
public async Task <IActionResult> Edit(int id, UserVModel model)// UserModel model { if (id != model.UserID) { return(NotFound()); } if (ModelState.IsValid) { model.Status = 1; string originalPassword = string.Empty; if (!string.IsNullOrEmpty(model.Password)) { originalPassword = model.Password; model.Password = Tools.GetHashedPassword(this.AppSettings, model.Password); } if (null != model.IDParamList && model.IDParamList.Any()) { model.UserRoleModelList = new List <UserRoleVModel>(); for (int index = 0; index <= model.IDParamList.Length - 1; index++) { int idUser = model.IDParamList[index].Split('|')[0] == "" ? model.UserID : int.Parse(model.IDParamList[index].Split('|')[0]); int idRole = int.Parse(model.IDParamList[index].Split('|')[1]); UserRoleVModel paramValue = new UserRoleVModel() { UserID = idUser, RoleID = idRole, Active = true }; model.UserRoleModelList.Add(paramValue); } } try { //TODO: Metodo para insertar if (await UpdateUserRole(model)) { return(RedirectToAction(nameof(Index))); } } catch (DataValidationException dex) { this.ModelState.AddModelError(dex.PropertyName, dex.ErrorMessage); } catch (Exception ex) { model.Password = originalPassword; } } return(View(model)); // model }
public ActionResult Add() { var vm = new UserVModel { Roles = Roles.RoleInfosToVModels(Roles.GetAllRole()) }; return(View(vm)); }
public JsonResult Reg(UserVModel model, string vercode) { if (string.IsNullOrEmpty(vercode)) { return(Json(new JsonResultModel { Message = "请输入验证码!" })); } if (!VerCode.CheckVerifyCode(vercode)) { return(Json(new JsonResultModel { Message = "验证码错误,请重新输入!" })); } if (Vip.UserNameIsHave(model.Name, null)) { return(Json(new JsonResultModel { Message = "用户名已存在" })); } if (Vip.NickNameIsHave(model.NickName, null)) { return(Json(new JsonResultModel { Message = "昵称已存在" })); } if (Vip.EmailIsHave(model.Email, null)) { return(Json(new JsonResultModel { Message = "邮箱已存在" })); } if (!ModelState.IsValid) { return(Json(new JsonResultModel { Message = ModelStateHelper.GetAllErrorMessage(ModelState) })); } bool status = Vip.AddUserInfo(model); if (status) { string refurl = Url.Action("Login", "Vip"); if (Request["backUrl"] != null) { refurl += "?backUrl=" + Request["backUrl"]; } return(Json(new JsonResultModel { ResultState = true, Action = refurl, Message = "注册成功,快去登陆吧!" })); } return(Json(new JsonResultModel { Message = "注册失败" })); }
/// <summary> /// 用户检测 /// </summary> /// <param name="filterContext"></param> protected override void OnActionExecuting(ActionExecutingContext filterContext) { //提取所有验证 RequestRoleAuthorize = new RequestRoleAuthorize(filterContext.Controller, filterContext.ActionDescriptor); //cookie 中json 信息 CurrentUserInfo = UsersLogin.CheckUserIsLoginAndGetUserInfo(); //cookie 中校验过的userid string userId = EncryptCookies.GetValue(CookieConfig.UserIdCkName); //正常登陆 if (CurrentUserInfo != null && CurrentUserInfo.Id.ToString(CultureInfo.InvariantCulture) == userId) { UserIsLogin = true; RequestRoleAuthorize = new RequestRoleAuthorize(filterContext.Controller, filterContext.ActionDescriptor); if (RequestRoleAuthorize.HaveVerification) { #region 用户信息 var user = Users.GetUserById(CurrentUserInfo.Id); if (user == null || user.IsNull) { UsersLogin.LogOut(); const string msg = "您的账户已不存在,如有疑问请联系管理员!"; filterContext.Result = AutoResult(msg, false, Url.Action("Warning", "Tips", new { msg })); } #endregion #region 校验禁用状态 if (RequestRoleAuthorize.IsDisableVerification && user.Disable) { const string msg = "您的账户已被禁用,如有疑问请联系管理员!"; filterContext.Result = AutoResult(msg, false, Url.Action("Warning", "Tips", new { msg })); } #endregion #region 需要邮箱激活验证 if (RequestRoleAuthorize.IsEmailActivatedVerification && !user.EmailStatus) { const string msg = "请激活邮箱后再进行操作,如有疑问请联系管理员!"; filterContext.Result = AutoResult(msg, false, Url.Action("activate", "user"), true); } #endregion } } else if (RequestRoleAuthorize.HaveVerification) //未登录时 如果需要权限判断 则跳出 { UsersLogin.LogOut(); //无法得到用户信息就登出清空原有cookie再次登陆 //需要验证 filterContext.Result = AutoResult("请重新登陆后操作!", false, Url.Action("Login", "Vip")); } #region 全局数据 ViewData["CurrentPartUserInfo"] = CurrentUserInfo; ViewData["WebName"] = WebSysConfig.WebName; ViewData["IsLogin"] = UserIsLogin; #endregion }
public ActionResult ForgetSetPassword(UserVModel user, string token) { if (string.IsNullOrEmpty(token)) { return(Json(new JsonResultModel { Message = "令牌校验错误,重置失败!" })); } ModelState.Remove("Name"); ModelState.Remove("NickName"); ModelState.Remove("Sex"); ModelState.Remove("RoleId"); ModelState.Remove("Avatar"); ModelState.Remove("Email"); if (!ModelState.IsValid) { return(Json(new JsonResultModel { Message = ModelStateHelper.GetAllErrorMessage(ModelState) })); } //通过token 得到id long tokenId = UserActivateTokensPublic.CheckToken(token, WebSysConfig.ActivateTokenExpireTime); if (tokenId <= 0) { return(Json(new JsonResultModel { Message = "令牌无效,重置失败,请重新获取找密码回邮件!" })); } //得到token 信息 var tokeninfo = UserActivateTokensPublic.GetUserActivateTokenVModel(tokenId); if (tokeninfo == null || tokeninfo.IsNull) { return(Json(new JsonResultModel { Message = "令牌无效,重置失败,请重新获取找密码回邮件!" })); } //得到email,通过email修改密码 bool status = UserPublic.UpdatePassword(tokeninfo.Email, user.Password); if (!status) { return(Json(new JsonResultModel { Message = "密码重置失败,稍后再试!" })); } //置令牌无效 UserActivateTokensPublic.UpdateStatus(tokenId, false); return(Json(new JsonResultModel { ResultState = true, Message = "密码重置成功,请使用新密码重新登陆!", Action = (UserIsLogin?"":Url.Action("Login", "Vip")) })); }
public UserVModel GetQueryByUserName(string userName) { var user = GetItemByExpression(x => x.UserName == userName); UserVModel userV = new UserVModel { UserID = user.UserID, UserName = user.UserName, Password = user.Password, IsSuperAdmin = user.IsSuperAdmin, Status = user.Status }; return(userV); }
public UserVModel GetQueryByUserId(int userId) { var user = GetItemByExpression(x => x.UserID == userId); UserVModel userV = new UserVModel { UserID = user.UserID, FirtsName = user.FirtsName, LastName = user.LastName, UserName = user.UserName, Password = user.Password, IsSuperAdmin = user.IsSuperAdmin, Status = user.Status }; return(userV); }
/// <summary> /// /// </summary> /// <param name="search"></param> /// <returns></returns> public PartialViewResult Index(CommentSearch search) { string order = search.Order == 0 ? "ASC" : "DESC"; if (search.PageIndex < 1) { search.PageIndex = 1; } int pageSize = Site.Config.PageConfig.WebCommentPageSize; int dataCount = 0; var list = new List <CommentEntity>(); var comments = Comments.GetComments(search.PageIndex, pageSize, search.AId, search.AuthorId, order, out dataCount); if (comments != null) { var users = Users.GetUsersByIds(comments.Select(n => n.UserId).ToArray()); foreach (var comment in comments) { var user = new UserVModel(); if (users.Any(n => n.Id == comment.UserId)) { user = users.FirstOrDefault(n => n.Id == comment.UserId); } list.Add(new CommentEntity { Comment = comment, User = user }); } } PagedList <CommentEntity> pageList = list.ToPagedList(search.PageIndex, pageSize); pageList.TotalItemCount = dataCount; pageList.CurrentPageIndex = search.PageIndex; //如果登录的话取得登录用户对该帖子下所有评论的点赞记录 if (UserIsLogin) { List <long> commentIds = DianZanLogsPublic.GetUserAllDianZanCommentId(CurrentUserInfo.Id, search.AId); if (commentIds.Count > 0) { pageList.ForEach(c => c.IsZan = commentIds.Any(n => n == c.Comment.Id)); } } ViewBag.search = search; return(PartialView(pageList)); }
public JsonResult Add(UserVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = Users.AddUser(Users.UserVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// 修改UserVModel /// </summary> /// <param name="user"></param> /// <returns></returns> public static bool UpdateUser(UserVModel user) { string sql = @"UPDATE [User] SET NickName=@NickName, Sex=@Sex, Email=@Email, EmailStatus=@EmailStatus WHERE Id=@Id"; var par = new DynamicParameters(); par.Add("@Id", user.Id, DbType.Int32); par.Add("@NickName", user.NickName, DbType.String); par.Add("@Sex", user.Sex, DbType.Int16); par.Add("@EmailStatus", user.EmailStatus, DbType.Boolean); par.Add("@Email", user.Email, DbType.AnsiString); return(DapWrapper.InnerExecuteSql(DbConfig.ArticleManagerConnString, sql, par) > 0); }
public bool AddUser(UserVModel model) { var newUser = new User() { Username = model.username, IsLocked = false, IsActive = true, Password = model.password, SecurityAnswer = model.securityQuestion, SecurityQuestion = model.securityAnswer, DateTimeCreated = DateTime.Now, FailedLogonAttempt = 0, IsFirstLoginAttempt = false, LastLoginDate = DateTime.Now }; DataContext.Users.Add(newUser); return(DataContext.SaveChanges() > 0); }
public static bool IsValid(string controllerName, string actionName) { UserVModel userModel = HttpContext?.Session?.Get <UserVModel>("User"); if (null != userModel) { if (userModel.IsSuperAdmin) { return(true); } var existsAction = userModel.ActionDetailList?.FirstOrDefault(p => p.ContainerName == controllerName && p.ControlID == actionName); if (null != existsAction) { return(true); } } return(false); }
protected void btnLogin_Click(object sender, EventArgs e) { UserVModel vmModel = new UserVModel(); Response.Cookies["UserName"].Value = Email.Text.Trim(); Response.Cookies["Password"].Value = Password.Text.Trim(); vmModel.UserName = Email.Text.Trim(); vmModel.Password = Password.Text.Trim(); UserMasterBuss login_Business = new UserMasterBuss(); bool msg = login_Business.LoginUser(vmModel); if (msg) { Response.Redirect("Classes.aspx"); } else { lblMsg.Visible = true; lblMsg.Text = "Login ID and Password is invalid."; } }
/// <summary> /// 登录接口 /// </summary> /// <param name="ope"></param> /// <returns></returns> public ActionResult LoginOn(staff ope) { ope.PassWord = Encrypt.MD5(ope.PassWord); var user = _bll.LoginOn(ope); if (user.Success) { var currentUser = UserVModel.FormatUser(user.Data); var strUser = JsonConvert.SerializeObject(currentUser); //页面session Session["user"] = strUser; //webapi登录验证用 CacheHelper.SetCache(Encrypt.MD5(currentUser.Id + "_" + currentUser.UserType), currentUser); return(Redirect("/Home/Index")); } else { return(Redirect("/Login/Index?msg=" + user.Msg)); } }
public DashboardVModel() { User = new UserVModel() { Email = UserSingleton.Instance.Email, Id = UserSingleton.Instance.Id, Name = UserSingleton.Instance.Name, DefaultCurrency = (CurrencyType)Enum.ToObject(typeof(CurrencyType), UserSingleton.Instance.DefaultCurrency), }; CurrentBudget = 0; OutcomesSum = OutcomesManager.SumOutcomes(); IncomesSum = IncomesManager.SumIncomes(); IncomesSumSavings = IncomesManager.SumIncomesSavings(); CurrentBudget = (IncomesSum - OutcomesSum > 0 ? IncomesSum - OutcomesSum : 0); CurrencyLabel = User.DefaultCurrency.GetType() .GetMember(User.DefaultCurrency.ToString()) .First() .GetCustomAttribute <DisplayAttribute>() .GetName(); }
public ApiMessage <object> LoginOn(staff user) { user.PassWord = Encrypt.MD5(user.PassWord); var userData = _bll.LoginOn(user); var outData = new ApiMessage <object> { Success = userData.Success, Msg = userData.Msg, MsgCode = userData.MsgCode }; if (!userData.Success) { return(outData); } var currentUser = UserVModel.FormatUser(userData.Data); var key = Encrypt.MD5(currentUser.Id + "_" + currentUser.UserType); outData.Data = new { token = key, UserName = currentUser.UserName, UserType = currentUser.UserType }; CacheHelper.SetCache(key, currentUser, new TimeSpan(0, 0, 30)); return(outData); }
//------------------------------------------------------------- Call Store procedure as Entity Method ----------------------------------------------------- //public ActionResult Register(UserVModel user) //{ // System.Data.Entity.Core.Objects.ObjectParameter xmlOut = new System.Data.Entity.Core.Objects.ObjectParameter("xmlOut", typeof(object)); // using (var _context = new Entities()) // { // var res = _context.WebShellUser(user.Name,user.Password, xmlOut); // } // var finRes = xmlOut.Value; // XmlDocument doc = new XmlDocument(); // doc.LoadXml(finRes.ToString()); // var userKey = doc.GetElementsByTagName("ShellMessageKey")[0].InnerText; // var userId = doc.GetElementsByTagName("ShellUserID")[0].InnerText; // if ( Int32.Parse(userKey) >= 0) // { // Session["userId"] = userId; // return RedirectToAction("Index", "Manu"); // } // else // { // user.ErrorMessage = "User Name or Password is incorrest !"; // return View("Index", user); // } //} //--------------------------------------------------------------------- Call Store Procedure Execute Store Query ------------------------------------------------------------- public ActionResult Register(UserVModel user) { // System.Data.Entity.Core.Objects.ObjectParameter xmlOut = new System.Data.Entity.Core.Objects.ObjectParameter("xmlOut", typeof(object)); SqlParameter userKey = new SqlParameter("@ShellUserKey", user.Name); SqlParameter UserPassword = new SqlParameter("@ShellUserPassword", user.Password); SqlParameter xmlOut = new SqlParameter { ParameterName = "@xmlOut", SqlDbType = System.Data.SqlDbType.Xml, Direction = System.Data.ParameterDirection.Output }; using (var _context = new Entities()) { var res = _context.Database.ExecuteSqlCommand("WebShellUser @ShellUserKey, @ShellUserPassword, @xmlOut OUTPUT", userKey, UserPassword, xmlOut); /*WebShellUser(user.Name, user.Password, xmlOut);*/ } var finRes = xmlOut.Value; XmlDocument doc = new XmlDocument(); doc.LoadXml(finRes.ToString()); var _userKey = doc.GetElementsByTagName("ShellMessageKey")[0].InnerText; var userId = doc.GetElementsByTagName("ShellUserID")[0].InnerText; if (Int32.Parse(_userKey) >= 0) { Session["userId"] = userId; return(RedirectToAction("Index", "Manu")); } else { user.ErrorMessage = "User Name or Passsword is incorrest !"; return(View("Index", user)); } }
public async Task <bool> UpdateUserRoleTODO(UserVModel model) { List <UserRoleEModel> usro = new List <UserRoleEModel>(); UserEModel us = new UserEModel { UserID = model.UserID, FirtsName = model.FirtsName, LastName = model.LastName, UserName = model.UserName, Password = model.Password, Status = model.Status, IsSuperAdmin = model.IsSuperAdmin }; foreach (var item in model.UserRoleModelList) { UserRoleEModel userRole = new UserRoleEModel { UserID = (int)item.UserID, RoleID = item.RoleID, Active = item.Active }; usro.Add(userRole); } // Initialize transaction using (var transaction = await Context.Database.BeginTransactionAsync(IsolationLevel.RepeatableRead)) { Context.Set <UserEModel>().Add(us); Context.Set <UserRoleEModel>().AddRange(usro); Console.WriteLine("transaction"); //await Context.SaveChangesAsync(); transaction.Commit(); } return(true); }
public ActionResult GetList() { var appUsers = UserManager.Users.Where(s => s.Deleted == false).ToList(); var model = new List <UserVModel>(); foreach (var user in appUsers) { var item = new UserVModel(); item.Id = user.Id; item.UserName = user.UserName; item.ContactNumber = user.PhoneNumber; item.Status = user.Status ?? false; item.ProfileId = user.ProfileId.Value; item.Email = user.Email; item.Roles = UserManager.GetRoles(user.Id).ToArray(); item.Profile = Context.UserProfileRepo.GetByID(user.ProfileId.Value); model.Add(item); } return(PartialView("_GetList", model)); }
public async Task <ActionResult> SetInfo(UserVModel user, UserOtherVModel other, string province, string city, string area) { ModelState.Remove("Name"); ModelState.Remove("ConfirmPassword"); ModelState.Remove("Password"); ModelState.Remove("RoleId"); ModelState.Remove("Avatar"); if (!ModelState.IsValid) { return(Json(new JsonResultModel { Message = ModelStateHelper.GetAllErrorMessage(ModelState) })); } user.Id = CurrentUserInfo.Id; other.UserId = CurrentUserInfo.Id; var olduser = Users.GetUserById(CurrentUserInfo.Id); //邮箱修改需要重新验证 if (olduser.Email.ToLower() != user.Email.ToLower()) { user.EmailStatus = false; } else { user.EmailStatus = olduser.EmailStatus; } //修改基本信息 var status = UserPublic.UpdateUser(user); if (!status) { return(Json(new JsonResultModel { Message = "修改基本信息失败!" })); } var userOther = await Users.GetUserOtherById(user.Id); if (userOther == null || userOther.IsNull) { status = await UserPublic.AddUserOther(other) > 0; } else { status = UserPublic.UpdateUserOther(other); } if (!status) { return(Json(new JsonResultModel { Message = "修改信息失败!" })); } await UserPublic.DeleteUserPosition(CurrentUserInfo.Id); #region 地址 if (!string.IsNullOrEmpty(province)) { int pid = await UserPublic.AddUserPosition(new UserPositionVModel { Code = int.Parse(province), Type = 0, UserId = CurrentUserInfo.Id }); if (pid == 0) { return(Json(new JsonResultModel { Message = "修改居住地区信息失败,!" })); } } if (!string.IsNullOrEmpty(city)) { int cid = await UserPublic.AddUserPosition(new UserPositionVModel { Code = int.Parse(city), Type = 1, UserId = CurrentUserInfo.Id }); if (cid == 0) { return(Json(new JsonResultModel { Message = "修改居住地区信息失败,!" })); } } if (!string.IsNullOrEmpty(area)) { int aid = await UserPublic.AddUserPosition(new UserPositionVModel { Code = int.Parse(area), Type = 2, UserId = CurrentUserInfo.Id }); if (aid == 0) { return(Json(new JsonResultModel { Message = "修改居住地区信息失败,!" })); } } #endregion UsersLogin.RefreshCookieUserInfo(CurrentUserInfo.Id); return(Json(new JsonResultModel { ResultState = true, Message = "修改成功!" })); }
public ActionResult Add() { var vm = new UserVModel(); return(View(vm)); }