public async Task <IActionResult> GetById(int id) { try { var model = await _carModelService.GetAsync(id); return(Ok(model)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Delete(int id) { try { var carModel = await _carModelService.GetAsync(id); if (carModel != null) { await _carModelService.DeleteAsync(carModel); } return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } }