public async Task <ActionResult> Delete(CharacteristicViewModel characteristicViewModel) { try { await _characteristicManager.Delete(characteristicViewModel.Id); return(RedirectToAction(nameof(Index))); } catch (Exception exception) { _logger.LogError($"Error occured during deleting characteristic. Exception: {exception.Message}"); return(View(characteristicViewModel)); } }
public async Task <ActionResult> Delete(int id) { try { await _characteristicManager.Delete(id); return(Ok()); } catch (Exception exception) { _logger.LogError($"Error occured during deleting characteristic. Exception: {exception.Message}"); return(BadRequest()); } }
public async Task Delete() { var id = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException()); await _characteristicManager.Delete(id); }