public ActionResult UnRegister(RegisterModel model) { if (model.Command == "gotoBills") { return RedirectToAction("Index", "Bills"); } else { Workflow uru = new Workflow { decision = "unregister", username = HomeController.un.Username, passwort = HomeController.un.Passwort }; IDictionary<string, object> output = WorkflowInvoker.Invoke(uru); if ((bool)output["success"]) { FormsAuthentication.SignOut(); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "Unregistration failed. If the problem persists, please contact your system administrator."); } } // If we got this far, something failed, redisplay form return View(); }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user // MembershipCreateStatus createStatus; Workflow ru = new Workflow { decision= "register", username = model.UserName, passwort = model.Password }; IDictionary<string, object> output = WorkflowInvoker.Invoke(ru); // Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus); if((bool)output["doesUserExist"]) { ModelState.AddModelError("", "User name already exists. Please enter a different user name."); } else//Success { //Save User for further process HomeController.un.Username = model.UserName; HomeController.un.Passwort = model.Password; FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */); return RedirectToAction("Index", "Home"); } } // If we got this far, something failed, redisplay form return View(model); }