public void UpdateAdvertiserData(int id, SaveAdvertiserMessage message) { var advertiser = _advertiserRepository.Get(id); advertiser.Email = message.Email; advertiser.Name = message.Name; advertiser.Password = _cryptographyService.Encrypt(message.Password); }
public Task UpdateAsync(Advertiser user) { var updatedUser = _advertiserRepository.Get(user.Id); updatedUser.Email = user.Email; updatedUser.Name = user.Name; updatedUser.UserName = user.UserName; return(_advertiserRepository.SaveChangesAsync()); }
public async Task <AuthenticateResponse> AuthenticateAdvertiser(AuthenticateRequest request) { var errors = request.Validate(); if (errors.Any()) { throw new ValidationException(errors); } var user = _advertiserRepository.Get(request.Username); if (user == null) { throw new Exception("Usuário não encontrado"); } _authenticationService.AuthenticateAdvertiser(request); await _signInService.SignInAdvertiserAsync(user, true); return(new AuthenticateResponse { ReturnUrl = request.ReturnUrl ?? "/Advertiser/Home/Index" }); }
public void Create(CreateServiceSolicitationMessage message) { var serviceSolicitation = new ServiceSolicitation(); serviceSolicitation.Location = _locationRepository.Get(message.LocationId); serviceSolicitation.Advertiser = _advertiserRepository.Get(message.AdvertiserId); serviceSolicitation.EndDate = message.EndDate; serviceSolicitation.ContractModel = _contractModelRepository.Get(message.ContractModelId); serviceSolicitation.MonthlyValue = serviceSolicitation.Location.MonthlyValue; serviceSolicitation.StartDate = message.StartDate; _serviceSolicitationRepository.Add(serviceSolicitation); _serviceSolicitationRepository.SaveChanges(); }
public IPrincipal AuthenticateAdvertiser(AuthenticateMessage message) { var advertiser = _advertiserRepository.Get(message.Username); if (advertiser == null) { throw new InvalidUsernameException(); } var encryptedProvidedPassword = _cryptographyService.Encrypt(message.Password); if (!advertiser.Password.Equals(encryptedProvidedPassword)) { throw new InvalidPasswordException(); } return(Authenticate(AUTHENTICATION_TYPE_ADVERTISER)); }