public IDataResult <User> Register(UserForRegisterDto userForRegisterDto, string password) { byte[] passwordHash, passwordSalt; HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt); var user = new User { Email = userForRegisterDto.Email, FirstName = userForRegisterDto.FirstName, LastName = userForRegisterDto.LastName, PasswordHash = passwordHash, PasswordSalt = passwordSalt, Status = true }; _userService.Add(user); var getUserId = _userService.GetByMail(userForRegisterDto.Email).UserId; var customer = new Customer { UserId = getUserId, CompanyName = userForRegisterDto.CompanyName }; _customerService.Add(customer); var getCustomerId = _customerService.GetByCompanyName(userForRegisterDto.CompanyName).Data.CustomerId; var findeks = new FindeksScore { CustomerId = getCustomerId, }; _findeksScoreService.Add(findeks); return(new SuccessDataResult <User>(user, Messages.UserRegistered)); }
public IActionResult Add(FindeksScore findeksScore) { var result = _findeksScoreService.Add(findeksScore); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }