public async Task <IActionResult> DeleteBatchEntry(int id) { var cmd = _journalCommandFactory.CreateBatchEntriesCommand(); var qry = _journalQueryFactory.CreateBatchEntriesQuery(); var dto = await qry.ExecuteAsync(id).ConfigureAwait(false); await cmd.DeleteAsync(dto).ConfigureAwait(false); return(RedirectToAction("Index", "Admin", new { id = "journals" })); }
public async Task <IActionResult> DeleteBatchEntryAsync(int id) { try { var entriesQuery = _queryFactory.CreateBatchEntriesQuery(); var entryDto = await entriesQuery.ExecuteAsync(id).ConfigureAwait(false); if (entryDto != null) { var cmd = _commandsFactory.CreateBatchEntriesCommand(); await cmd.DeleteAsync(entryDto).ConfigureAwait(false); } return(Ok()); } catch (Exception) { return(StatusCode(500)); throw; } }