// GET: ModelController/Details/5 public async Task <ActionResult> Details(int id) { var carModel = await _repo.FindById(id); var model = _mapper.Map <Model, CreateModelVM>(carModel); if (model == null) { return(NotFound()); } return(View(model)); }
public async Task <IActionResult> GetModel(int id) { try { var model = await _modelRepository.FindById(id); if (model == null) { return(NotFound()); } var response = _mapper.Map <ModelDTO>(model); return(Ok(response)); } catch (Exception e) { return(InternalError($"{e.Message} - {e.InnerException}")); } }
public Optional <T> FindById(Guid itemGuid) { try { return(_modelRepository.FindById(itemGuid)); } catch (Exception e) { return(Codes.DbError(e.Message)); } }
public Model FindById(int id) { return(_modelRepository.FindById(id)); }