public int Create(AppUserCreateRequest request) { int newId = 0; string password = BCrypt.HashPassword(request.Password); dataProvider.ExecuteNonQuery( "AppUser_Insert", (parameters) => { parameters.AddWithValue("@FirstName", request.FirstName); parameters.AddWithValue("@LastName", request.LastName); parameters.AddWithValue("@PasswordHash", password); parameters.AddWithValue("@Email", request.Email); parameters.AddWithValue("@RegisterToken", request.RegisterToken); parameters.AddWithValue("@IsConfirmed", 0); parameters.AddWithValue("@TenantId", request.TenantId); parameters.AddWithValue("@CustomerBusinessId", request.CustomerBusinessId); parameters.Add("@Id", SqlDbType.Int).Direction = ParameterDirection.Output; }, (parameters) => { newId = (int)parameters["@Id"].Value; }); return(newId); }
public async Task <ActionResult <bool> > Create(AppUserCreateRequest request) { var applicationUser = new ApplicationUser { Fullname = $"{request.Name.Trim()} {request.Surname.Trim()}", Email = request.Email, EmailConfirmed = true, NormalizedEmail = request.Email, NormalizedUserName = request.Email, UserName = request.Email, TenantId = TenantContext.Tenant.Id }; var response = await _userService.Create(applicationUser, request.Password); return(response.ToActionResult(this)); }
public HttpResponseMessage Create(AppUserCreateRequest appUserCreateRequest) { if (appUserCreateRequest == null) { ModelState.AddModelError("", "missing body data"); } if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } EmailSenderService.SendEmail(appUserCreateRequest); int newAppUserId = appUserService.Create(appUserCreateRequest); return(Request.CreateResponse(HttpStatusCode.Created, new ItemResponse <int> { Item = newAppUserId })); }
public static void SendEmail(AppUserCreateRequest req) { Execute(req.FirstName, req.RegisterToken, req.Email).Wait(); }