Exemple #1
0
        public async Task ExecuteAsync()
        {
            var items = await GetValuesQuery.ExecuteAsync();

            var itemsToUpdate = items.Select((Value, Index) => new { Index, Value })
                                .Where(x => (x.Index % 2) != 0)
                                .Select(x => x.Value);

            foreach (Item item in itemsToUpdate)
            {
                await CommandsDispatcher.ExecuteAsync(new UpdateItemCommand(item.Id, item.Value?.ToLowerInvariant()));
            }
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            try
            {
                var user = await identityService.GetCurrentUserAsync();

                await commandsDispatcher.ExecuteAsync(new CreateAppointmentCommand(userId : user.Id, timeSlotId : TimeSlotId.GetValueOrDefault()));

                return(RedirectToPage("/User/Profile"));
            }
            catch (Exception)
            {
                return(RedirectToPage("/Appointments/Failed"));
            }
        }
 public async Task Update(int id, string value)
 {
     await CommandsDispatcher.ExecuteAsync(new UpdateItemCommand(id, value));
 }
Exemple #4
0
        public async Task <IActionResult> Post([FromBody] TagInputModel tag)
        {
            await _commandsDispatcher.ExecuteAsync(new TweetsRefreshCommandContext(tag.Value, _tweetsSettings.TweetsCount, _tweetsSettings.IsSaveHistory, _tweetsSettings.ResultType));

            return(Ok());
        }
Exemple #5
0
 public async Task Delete(int id)
 {
     _logger.LogInformation("Delete value request");
     await _commandsDispatcher.ExecuteAsync(new DeleteValueAsyncCommandContext(id));
 }
 public async Task Post(int customerId, [FromBody] OrderEditModel editModel)
 {
     var createCommand = new CreateOrderCommand(customerId, editModel.Price);
     await _commandsDispatcher.ExecuteAsync(createCommand);
 }
 public async Task Post([FromBody] CustomerEditModel editModel)
 {
     var createCommand = new CreateCustomerCommand(editModel.Name, editModel.Email);
     await _commandsDispatcher.ExecuteAsync(createCommand);
 }