public void Register(User obj) { Save(obj); }
public void Save(User obj) { MainDb.Instant.Save(obj); }
public ActionResult Login(FormCollection f) { var _msg = Msg.Create(); var _pwd = f["pwd"].Password(); var _user = f["uid"]; UserInfo _u = null; if (_user.Equals(ConfigurationManager.AppSettings["uid"]) && _pwd.Equals(ConfigurationManager.AppSettings["pwd"])) { _u = new UserInfo() { IsAdmin = true, UserName = _user, Pwd = _pwd, }; var _uc = UsersRepo.LogIn(_u.UserName, _u.Pwd, true); if (_uc == null) { var _userInfo = new User() { UserName = _u.UserName, Pwd = _u.Pwd, Status = (int)UserStatus.Actived, FullName = "Administrator", Email = "*****@*****.**" }; new UsersRepo().Save(_userInfo); } } else { _u = UsersRepo.LogIn(_user, _pwd, true); } if (_u != null && _u.IsAdmin) { IWebContext.SetAuthenticationCookie(_user, _pwd, true); _msg.ReturnUrl = f["returnUrl"]; } else { _msg.Text = "Username or Password is incorrect."; } return JavaScript(_msg.ToJavaScript()); }