public ActionResult Register(string userId, string password, string firstName, string lastName) { AccountInfo info = new AccountInfo(); if (ModelState.IsValid) { info.userid = userId; info.password = password; info.firstname = firstName; info.lastname = lastName; try { using (svcClient = new AccountServiceClient()) { if (svcClient.CreateAccount(info)) { return(View("Index")); } } } catch (FaultException <AccountServiceFault> ex) { HandleErrorInfo errorInfo = new HandleErrorInfo(ex, "Home", "Register"); return(View("Error", errorInfo)); } } ViewBag.RegistionFailed = String.Format("Oops... user id: {0} already exists, please choose another one!", userId); return(View()); }
private void btnCreateAccount_Click(object sender, EventArgs e) { var acctService = new AccountServiceClient(); var acct = new Account(); acct.FirstName = txtFirstName.Text; acct.LastName = txtLastName.Text; acct.UserName = txtUserName.Text; acct.Password = txtPassword.Text; lblCreateAccMessage.Text = acctService.CreateAccount(acct); }
public ActionResult CreateAccount(Models.AccountViewModel acct) { var acctService = new AccountServiceClient(); var profile = new Account(); profile.FirstName = acct.FirstName; profile.LastName = acct.LastName; profile.UserName = acct.UserName; profile.Password = acct.Password; var message = acctService.CreateAccount(profile); return(Json(message, JsonRequestBehavior.AllowGet)); }
public ActionResult Register(string userId, string password, string firstName, string lastName) { AccountInfo info = new AccountInfo (); if (ModelState.IsValid) { info.userid = userId; info.password = password; info.firstname = firstName; info.lastname = lastName; try { using (svcClient = new AccountServiceClient()) { if (svcClient.CreateAccount(info)) { return View("Index"); } } } catch (FaultException<AccountServiceFault> ex) { HandleErrorInfo errorInfo = new HandleErrorInfo(ex, "Home", "Register"); return View("Error", errorInfo); } } ViewBag.RegistionFailed = String.Format("Oops... user id: {0} already exists, please choose another one!", userId); return View(); }