public JsonResult UpdateName(EditNameModel model) { JsonModel jm = new JsonModel(); try { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == model.Id); if (sc != null) { //修改名称 sc.Name = model.Name; socialCircleBLL.Update(sc); } else { jm.Msg = "圈子已不存在"; } } catch { jm.Msg = "请求发生异常"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public IActionResult EditName(string userId) { EditNameModel model = new EditNameModel(); model.UserID = userId; return(View(model)); }
public async Task <IActionResult> EditName(EditNameModel model) { if (ModelState.IsValid) { User user = await _context.GetUser(model.UserID); user.NickName = model.UserName; await _context.EditUser(user); return(RedirectToAction("Profile")); } return(View(model)); }
public ActionResult UpdateName(int id) { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); EditNameModel model = new EditNameModel() { Id = sc.Id, Name = sc.Name }; return(View(model)); }
public ActionResult Editname(EditNameModel model) { if (model.Username != model.CUsername) { ModelState.AddModelError("", "Username is not the same"); } else if (ModelState.IsValid) { var user = Services.MemberService.GetByUsername(User.Identity.GetUserName()); user.Username = model.Username; Services.MemberService.Save(user); TempData.Clear(); Session.Clear(); FormsAuthentication.SignOut(); return(Redirect("http://localhost:52587/login/")); } return(View()); }