public async Task <Dictionary <string, string> > Insert(WeatherInsertCommand command) { try { var data = command.Validate(); if (!data.IsValid) { HandleErrors(command, data); return(command.Notifications); } await Transaction(command, async() => { await _weatherWriteRepository.Insert(command.Map()); }); return(command.Notifications); } catch (Exception ex) { command.Notifications.Add("Error", ex.Message); return(command.Notifications); } }
public async Task <IActionResult> Insert([FromBody] WeatherInsertCommand command) { await _handler.Insert(command); return(Ok(command.Notifications)); }