// GET: CarModel/Details/5 public ActionResult Details(int id) { var mapper = new MapperConfiguration(cg => cg.CreateMap <CarModelDTO, CarModelView>()).CreateMapper(); var modelView = mapper.Map <CarModelDTO, CarModelView>(_carModelService.GetCarModel(id)); return(View(modelView)); }
public ActionResult <CarModel> GetCarModel(int carBrandId, int idModel) { try { var model = carModelService.GetCarModel(carBrandId, idModel); return(Ok(model)); } catch (NotFoundItemException ex) { return(NotFound(ex.Message)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }