/// <summary> /// Creates a new user. /// </summary> private ActionResult CreateUser(LoginModel model) { if (ModelState.IsValid == false) { return(RedirectToAction("Index", "Login")); } // Do some manual validation if (string.IsNullOrEmpty(model.Username) || string.IsNullOrEmpty(model.Password)) { ModelState.AddModelError("", "Username and Password cannot be blank."); return(RedirectToAction("Index", "Login")); } UserDto user = _usersDao.AddUser(model.Username, model.Password); if (user == null) { // Go back to the user screen with an error ModelState.AddModelError("", "User Already Exists."); return(RedirectToAction("Index", "Login")); } // In a real app, you wouldn't use Session, but this is just an example app, so cheat and use session Session["user"] = user; _statsDao.IncrementCounter("users"); return(RedirectToAction("Index", "Playlists")); }
public Guid AddUser(User user) { if (user.Id == Guid.Empty) { return(Guid.Empty); } return(_usersDao.AddUser(user)); }
public void AddUser(User value) { UserDao.AddUser(value); }