public async Task GeneratePasscode() { if (OperationInProgress) { return; } OperationInProgress = true; ValidateForm(); if (IsValid) { PasscodeModel code = new PasscodeModel(); code.PasscodeID = 0; code.PassCode = null; code.RoleId = SelectedRole.RoleId; code.RecipientEmail = Email; code.SenderID = App.UserId; code.IsSignedUp = false; code.MailMessage = Message; code.SenderEmail = App.UserEmail; code.CreationDate = DateTime.Now; code.ModifiedDate = DateTime.Now; var result = await new APIData().PostData <int>("User/InsertPasscodeData", code, false); if (result > 0) { } } OperationInProgress = false; }
public async Task <IActionResult> CreatePasscode([FromBody] PasscodeModel model) { User user = _dbContext.users.Find(User.GetId()); user.Passcode = GetHashSHA256(model.Passcode); await _dbContext.SaveChangesAsync(); return(StatusCode(201, new { Message = "Passcode created successfully." })); }
public async Task RegisterAsync() { if (OperationInProgress) { return; } // ValidateForm(); if (IsValid) { OperationInProgress = true; UserModel _user = new UserModel(); _user.FirstName = FirstName; _user.LastName = LastName; // _user.RoleID = PassCodeData.RoleId; _user.Email = Email; _user.Password = Password; var result = await new APIData().PostData <int>("User/Registration", _user, false); //var result = await SignupProvider.SignupAsync(_user); // var result =await SignupProvider.SignupAsync(FirstName, LastName, SelectedRole.RoleId, Email, Password, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); if (result > 0) { PasscodeModel data = new PasscodeModel(); data.RecipientEmail = Email; data.IsSignedUp = true; await new APIData().PostData <int>("User/UpdatePasscode", data, false); Message = "Welcome to Fuel Dash."; App.UserId = result; } else { Message = "Sign up failed."; } OperationInProgress = false; } }