Ejemplo n.º 1
0
        public async Task <Dictionary <string, string> > Delete(WeatherDeleteCommand command)
        {
            try
            {
                var data = command.Validate();
                if (!data.IsValid)
                {
                    HandleErrors(command, data);
                    return(command.Notifications);
                }

                await Transaction(command, async() =>
                {
                    await _weatherWriteRepository.Delete(command.Id);
                });

                return(command.Notifications);
            }
            catch (Exception ex)
            {
                command.Notifications.Add("Error", ex.Message);
                return(command.Notifications);
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete([FromBody] WeatherDeleteCommand command)
        {
            await _handler.Delete(command);

            return(Ok(command.Notifications));
        }