private async Task <IActionResult> Register(string userUuid) { var number = await GetNumber(); // 503 Error, Fail get number if (number == null) { return(new StatusCodeResult(503)); } var newItem = new UserModel(); newItem.UserUuid = userUuid; newItem.Major = number.Major.ToString(); newItem.Minor = number.Minor.ToString(); newItem.SetStatus(Common.UserStatus.None); var newItemResult = await Cosmos.User.CreateItemAsync(newItem); var result = new RegisterResultModel(); result.UserUuid = userUuid; result.Major = newItem.Major; result.Minor = newItem.Minor; return(new OkObjectResult(result)); }
public ActionResult RegisterResult(int resultId) { var resultText = string.Empty; switch ((UserRegistrationType)resultId) { case UserRegistrationType.Disabled: resultText = "Registration not allowed. Please contact us for more information."; break; case UserRegistrationType.Standard: resultText = "Your registration completed."; break; case UserRegistrationType.AdminApproval: resultText = "Your account is pending for approval."; break; case UserRegistrationType.EmailValidation: resultText = "Your registration has been successfully completed. You have just been sent an email containing membership activation instructions."; break; default: break; } var model = new RegisterResultModel { Result = resultText }; return(View(model)); }
private async Task <IActionResult> Register(string userUuid) { var number = await UserRepository.NextSequenceNumber(); // 503 Error, Fail get number if (number == null) { return(new StatusCodeResult(503)); } var newItem = new UserModel(); var secret = Cryption.CreateSecret(); newItem.UserUuid = userUuid; newItem.Major = number.Major.ToString(); newItem.Minor = number.Minor.ToString(); newItem.SetStatus(Common.UserStatus.None); newItem.ProtectSecret = Cryption.Protect(secret); await UserRepository.Create(newItem); var result = new RegisterResultModel(); result.UserUuid = userUuid; result.Major = newItem.Major; result.Minor = newItem.Minor; result.Secret = secret; return(new OkObjectResult(result)); }
public async Task <IHttpActionResult> Register(RegisterBindingModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var lastMembershipNumber = BigInteger.Parse(UserManager.Users.OrderByDescending(a => a.MembershipNumber).First().MembershipNumber); var nextMembershipNumber = (lastMembershipNumber + 1).ToString(); var user = new ApplicationUser() { UserName = model.Email, Email = model.Email, MembershipNumber = nextMembershipNumber }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { return(GetErrorResult(result)); } var response = new RegisterResultModel() { MembershipNumber = nextMembershipNumber }; return(Ok(response)); }
public virtual RegisterResultModel PrepareRegisterResultModel(int resultId) { var resultText = ""; switch ((UserRegistrationType)resultId) { case UserRegistrationType.Disabled: resultText = _localizationService.GetResource("Account.Register.Result.Disabled"); break; case UserRegistrationType.Standard: resultText = _localizationService.GetResource("Account.Register.Result.Standard"); break; case UserRegistrationType.AdminApproval: resultText = _localizationService.GetResource("Account.Register.Result.AdminApproval"); break; case UserRegistrationType.EmailValidation: resultText = _localizationService.GetResource("Account.Register.Result.EmailValidation"); break; default: break; } var model = new RegisterResultModel { Result = resultText }; return(model); }
public ActionResult RegisterResult(int resultId) { var resultText = ""; switch ((UserRegistrationType)resultId) { case UserRegistrationType.Disabled: resultText = "Registration is disabled"; break; case UserRegistrationType.Standard: resultText = "Standard"; break; case UserRegistrationType.AdminApproval: resultText = "Admin Approval"; break; default: break; } var model = new RegisterResultModel { Result = resultText }; return(View(model)); }
/// <summary> /// Prepare the register result model /// </summary> /// <param name="resultId">Value of UserRegistrationType enum</param> /// <returns>Register result model</returns> public RegisterResultModel PrepareRegisterResultModel(int resultId) { var resultText = ""; switch ((UserRegistrationType)resultId) { case UserRegistrationType.Disabled: resultText = "Account Disabled"; break; case UserRegistrationType.Standard: resultText = "Account Standard"; break; case UserRegistrationType.AdminApproval: resultText = "Account AdminApproval"; break; case UserRegistrationType.EmailValidation: resultText = "ระบบได้ลงทะเบียนผู้วิจัยเรียบร้อยแล้ว โปรดยืนยันอีเมลของท่าน ก่อนเข้าใช้ระบบงาน!"; break; default: break; } var model = new RegisterResultModel { Result = resultText }; return(model); }
public void CreateMethod() { // action var model = new RegisterResultModel(); // assert Assert.IsNotNull(model); }
public void PropertiesTest() { // preparation var model = new RegisterResultModel(); // model property access Helper.ModelTestHelper.PropetiesTest(model); }
public ActionResult RegisterClose() { var model = new RegisterResultModel { Result = "对不起,社区暂时关闭注册" }; return(View(model)); }
/// <summary> /// Compares between the two regiseters /// +1 for evert correct value /// -1 for every unlike value /// -0.25 for every null value that has been set by the student /// </summary> /// <param name="computerSolution"></param> /// <param name="studentSolution"></param> /// <returns>The student mark</returns> public static float CompareRegisters(this RegisterResultModel computerSolution, RegisterResultModel studentSolution) { //The student mark float mark = 0; //Correct each filed mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.Operation, studentSolution.Operation); return(mark); }
public ActionResult RegisterResult(int resultId = 1) { var resultText = _localizationService.GetResource("Account.Register.Result.Standard"); var model = new RegisterResultModel { Result = resultText }; return(View(model)); }
/// <summary> /// Prepare the register result model /// </summary> /// <param name="resultId">Value of UserRegistrationType enum</param> /// <returns>Register result model</returns> public virtual RegisterResultModel PrepareRegisterResultModel(int resultId) { var resultText = ""; var model = new RegisterResultModel { Result = resultText }; return(model); }
private async Task <IActionResult> Register(string userUuid) { var newItem = new UserModel(); var secret = Cryption.CreateSecret(userUuid); newItem.UserUuid = userUuid; newItem.ProtectSecret = Cryption.Protect(secret); await UserRepository.Create(newItem); var result = new RegisterResultModel(); result.UserUuid = userUuid; result.Secret = secret; return(new OkObjectResult(result)); }
private async Task <IActionResult> Register(string userUuid) { var newItem = new UserModel() { UserUuid = userUuid, ProtectSecret = DUMMY_PROTECT_SECRET }; await UserRepository.Create(newItem); var result = new RegisterResultModel() { // set dummy infos UserUuid = DUMMY_UUID, Secret = DUMMY_SECRET, JumpConsistentSeed = newItem.JumpConsistentSeed, }; return(new OkObjectResult(result)); }
public async Task <RegisterResultModel> Register(RegisterRequestModel data) { RegisterResultModel app = await base.Post <RegisterResultModel>("register", null, data); return(app); }
public void CreateMethod() { // action var model = new RegisterResultModel(); }