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