public async Task <object> Register([FromBody] RegisterDto model) { if (ModelState.IsValid) { var user = new IdentityUser { UserName = model.Email,//model.GetUserName(), Email = model.Email }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { await _signInManager.SignInAsync(user, false); var freelancer = new Freelancer { Id = new Guid(user.Id), FirstName = model.FirstName, LastName = model.LastName }; _WorkRepository.AddFreelancer(freelancer); _WorkRepository.Save(); return(await GenerateJwtToken(model.Email, user)); } return(result.Errors); } return(BadRequest("Invalid registration..!\n" + "Please fill out and resend registration model variables\n" + "FirstName': 'Name', 'LastName': 'Name', 'Email': 'email', 'Password': '******'")); }