public ActionResult HandleFormSubmit(NewUserViewModel model) { // Add some validation here if ( ( model.username != null) && (model.email != null)) { var newUser = Services.UserService.CreateUserWithIdentity(model.username, model.email, Services.UserService.GetUserTypeByAlias(model.memberTypes[0])); string mediaRoot = Regex.Replace(model.mediaAreas[0], @"[)(A-Za-z \-]", string.Empty); newUser.StartMediaId = int.Parse(mediaRoot); Services.UserService.Save(newUser, true); } return CurrentUmbracoPage(); }
// // GET: /NewUserSurface/ public ActionResult Index() { // I display the form that the user first see's var dataToDisplay = new NewUserViewModel(); //TODO set options here. foreach (var typeOfMember in Services.UserService.GetAllUserTypes()) { dataToDisplay.memberTypes.Add(typeOfMember.Alias); } foreach (var typeOfmedia in Services.MediaService.GetRootMedia()) { dataToDisplay.mediaAreas.Add(typeOfmedia.Name + " (" + typeOfmedia.Id.ToString() + ")"); } return PartialView("NewUser", dataToDisplay); }