public JsonResult AccountCreate(string username, string password, string confirmpassword, string phone, string email, string realname, string address, string cover) { if (string.IsNullOrEmpty(username)) { hitStr = "用户名不能为空!"; } else if (string.IsNullOrEmpty(password)) { hitStr = "请输入姓名!"; } else if (string.IsNullOrEmpty(confirmpassword)) { hitStr = "请输入确认密码!"; } else if (password != confirmpassword) { hitStr = "两次密码输入不一致!"; }else{ AdminAccount account = new AdminAccount() { UserName=username, PassWord=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password,"MD5"), Phone=phone, RealName=realname, Address=address, Cover=cover, Email=email }; using (club = new ClubEntities()) { club.AdminAccounts.Add(account); if (club.SaveChanges() > 0) { status = Status.success; hitStr = "账号创建成功!"; } } } return Json(new { status = status.ToString() ,context=hitStr}); }
public ActionResult AccountCreate(){ adminAccount = new AdminAccount(); using(club=new ClubEntities()){ ViewBag.adminTypes = GetAdminTypeList(club); } return View("~/areas/bwum/views/role/accountcreate.cshtml", adminAccount); }