public async Task <ActionResult> Delete(int id) { try { await _manufacturerManager.Delete(id); return(Ok()); } catch (Exception exception) { _logger.LogError($"Error occured during deleting manufacturer. Exception: {exception.Message}"); return(Ok()); } }
public async Task <IActionResult> Delete(ManufacturerViewModel manufacturerViewModel) { try { await _manufacturerManager.Delete(manufacturerViewModel.Id); return(RedirectToAction(nameof(Index))); } catch (Exception exception) { _logger.LogError($"Error occured during deleting manufacturer. Exception: {exception.Message}"); return(View(manufacturerViewModel)); } }
public async Task Delete() { Console.WriteLine("Enter Id of manufacturer for delete"); var id = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException()); await _manufacturerManager.Delete(id); }