public async Task <IActionResult> Delete(Guid id) { var hero = await _heroesRepository.GetByIdAsync(id); if (hero != null) { _heroesRepository.Delete(hero); await _heroesRepository.SaveAsync(); return(Ok()); } else { return(NotFound()); } }
public async Task <IActionResult> Delete(Guid key) { try { var heroEntity = await _heroesRepository.Find(key).ConfigureAwait(false); if (heroEntity == null) { return(NotFound()); } await _heroesRepository.Delete(key).ConfigureAwait(false); return(StatusCode(Status204NoContent)); } catch (Exception ex) { _logger.LogError(ex, "Failure on hero."); return(StatusCode(Status500InternalServerError)); } }
public void Delete(int id) { _repository.Delete(id); }
public ICommandResult Handle(DeleteHeroCommand command) { return(_heroesRepository.Delete(command)); }
public async Task <IActionResult> Delete(int id) { await _heroesRepository.Delete(id); return(Accepted()); }