public async Task <IActionResult> Delete(int id) { try { var carBrand = await _carBrandService.GetAsync(id); if (carBrand != null) { await _carBrandService.DeleteAsync(carBrand); } return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } }
public async Task <IActionResult> Delete(int id) { try { var carBrand = await _carBrandService.GetAsync(id); if (carBrand != null) { var result = await _carBrandService.DeleteAsync(carBrand); if (result == -1) { return(BadRequest("Error delete")); } } return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }