private PointSystemConfiguration BuildConfigurationFromDTO(PointSystemConfigurationDTO configurationDTO) { PointSystemConfiguration configuration = new PointSystemConfiguration(); configuration.PropertyName = configurationDTO.PropertyName; configuration.PropertyValue = configurationDTO.PropertyValue; return(configuration); }
private void UpdateUserPoints(Cart currentCart, string userId) { PointSystemConfiguration pointSystemConfiguration = configurationRepository.GetByPropertyName(ESportUtils.LOYALTY_PROPERTY_NAME); int totalPoints = CalculateLoyaltyPoints(Convert.ToDouble(pointSystemConfiguration.PropertyValue), currentCart.Items); User currentUser = GetCurrentUser(userId); currentUser.Points += totalPoints; userRepository.UpdateEntity(currentUser); }
public void UpdateConfiguration(PointSystemConfigurationDTO configurationDTO) { try { PointSystemConfiguration configurationToUpdate = pointSystemConfiguration.GetByPropertyName(configurationDTO.PropertyName); configurationToUpdate.PropertyValue = configurationDTO.PropertyValue; pointSystemConfiguration.UpdateEntity(configurationToUpdate); } catch (RepositoryException e) { throw new OperationException(e.Message, e); } }
public void RemoveConfiguration(PointSystemConfigurationDTO configurationDTO) { PointSystemConfiguration configurationToRemove = pointSystemConfiguration.GetByPropertyName(configurationDTO.PropertyName); pointSystemConfiguration.RemoveEntity(configurationToRemove); }