public ActionResult PartialTelephone(string id) { UserTelephoneViewModel model = new UserTelephoneViewModel(); model.UserId = int.Parse(id); model.UserName = System.Web.HttpContext.Current.Request.Cookies["User"].Value; return View(model); }
public ActionResult EditTelephone(UserTelephoneViewModel model) { try { UserDto dto = new UserDto(); Message msg = new Message(); DataTable dt = CMSService.SelectOne("User", "CMSUser", "UserName!='" + model.UserName + "' and UserTelephone='" + model.UserTelephone + "'"); if (dt.Rows.Count > 0) { msg.MessageStatus = "Error"; msg.MessageInfo = "此手机已经被其他用户占用。"; ViewBag.Status = msg.MessageStatus; ViewBag.msg = msg.MessageInfo; return View("UserInfo"); } else { msg = CMSService.UpdateFieldOneByOne("User", "CMSUser", "UserName='******'", "UserTelephone", model.UserTelephone); msg.MessageStatus = "Success"; msg.MessageInfo = "手机更改成功"; ViewBag.Status = msg.MessageStatus; // TODO: Add delete logic here return RedirectTo("/User/Index", msg.MessageInfo); } } catch { Message msg = new Message(); msg.MessageStatus = "Error"; msg.MessageInfo = "操作出错了"; ViewBag.Status = msg.MessageStatus; ViewBag.msg = msg.MessageInfo; return View("UserInfo"); } }