Exemplo n.º 1
0
        public async Task <Unit> Handle(SaveSettingCommand request, CancellationToken cancellationToken)
        {
            var property = settings.GetType().GetProperty(request.Property);

            property.SetValue(settings, request.Value);

            await mediator.Send(new SaveSettingsCommand(settings));

            return(Unit.Value);
        }
Exemplo n.º 2
0
        public async Task <Unit> Handle(SaveSettingCommand request, CancellationToken cancellationToken)
        {
            var property = settings.GetType().GetProperty(request.Property);
            var value    = property.GetValue(settings);

            if (value != null && request.Value != null && value.Equals(request.Value))
            {
                return(Unit.Value);
            }

            property.SetValue(settings, request.Value);
            await mediator.Send(new SaveSettingsCommand(settings));

            return(Unit.Value);
        }