public BasicResponse Register(RegisterDTO dto) { BasicResponse response = new BasicResponse(); try { var account = new Account() { Name = dto.Fullname, Id = dto.AccountId, IsActive = true, CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, }; _accountRepository.Save(account); var entity = new User() { Username = dto.Username, Id = dto.Id, IsActive = true, CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, AccountId = dto.AccountId, Email = dto.Email, Fullname = dto.Fullname, Password = dto.Password, PhoneNumber = dto.PhoneNumber, UserType = (UserType)dto.UserTypeId, RegistrationType = (RegistrationType)dto.RegistrationTypeId }; _userRepository.Save(entity); response.Status = true; response.Info = "Success"; } catch (Exception ex) { response.Status = false; if (ex is DomainValidationException) { var dex = ex as DomainValidationException; response.Info = dex.FormatException(); } else { response.Status = false; response.Info = ex.Message; } } return response; }
public BasicResponse Register(RegisterDTO register) { var all = _dataTransferBuilder.Register(register); return all; }