public async Task HandleAsync(FooCommand command)
        {
            if (command.Value == null)
            {
                throw new FooCommandException("Value cannot be null", 1337, "Try setting the value to 'en-US'");
            }

            _cultureService.SetCurrentCulture(command.Value);

            await Task.CompletedTask;
        }
        public async Task <Baz> HandleAsync(BazCommand command)
        {
            var result = new Baz();

            try
            {
                _cultureService.SetCurrentCulture(command.Value);

                result.Success = true;
            }
            catch
            {
                // TODO: do some real log stuff
            }

            return(await Task.FromResult(result));
        }
Beispiel #3
0
 public Task <Result> Handle(SetUserCultureCommand request, CancellationToken cancellationToken)
 {
     _culture.SetCurrentCulture(request.NewCulture);
     return(Task.FromResult(Result.Success()));
 }
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            ICultureService cultureService = App_Start.UnityConfig.GetConfiguredContainer().Resolve <ICultureService>();

            cultureService.SetCurrentCulture(base.Context.Request);
        }
        public async Task HandleAsync(FooCommand command)
        {
            _cultureService.SetCurrentCulture(command.Value);

            await Task.Delay(10); // TODO: do some real command stuff
        }