public async Task <string> InsertUser(UserRegisterParameter registerParameter) { try { if (registerParameter == null) { return("Something went wrong"); } var user = new IdentityUser { UserName = registerParameter.UserName, Email = registerParameter.Email, SecurityStamp = new Guid().ToString() }; var result = await _userManager.CreateAsync(user, registerParameter.Password); if (result.Succeeded) { await _userManager.AddToRoleAsync(user, "User"); return("Saved Successfully"); } return("Something went wrong"); } catch (Exception ex) { return(ex.Message); } }
public async Task <IActionResult> Register([FromBody] UserRegisterParameter parameter) { var result = await _accountBusiness.InsertUser(parameter); return(Ok(result)); }