Exemple #1
0
        public async Task <Dictionary <string, string> > Update(WeatherUpdateCommand command)
        {
            try
            {
                var data = command.Validate();
                if (!data.IsValid)
                {
                    HandleErrors(command, data);
                    return(command.Notifications);
                }

                await Transaction(command, async() =>
                {
                    await _weatherWriteRepository.Update(command.Map());
                });

                return(command.Notifications);
            }
            catch (Exception ex)
            {
                command.Notifications.Add("Error", ex.Message);
                return(command.Notifications);
            }
        }
        public async Task <IActionResult> Update([FromBody] WeatherUpdateCommand command)
        {
            await _handler.Update(command);

            return(Ok(command.Notifications));
        }