Ejemplo n.º 1
0
        // 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));
        }
Ejemplo n.º 2
0
 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));
     }
 }