Beispiel #1
0
        public IActionResult Add()
        {
            var carCreation = new CarViewModel();
            var garages     = _garageService.GetGarages();

            carCreation.GaragesList = _mapper.Map <List <SelectListItem> >(garages);

            return(View(carCreation));
        }
        public IActionResult GetGarages()
        {
            var garages = _garageService.GetGarages();
            var model   = _mapper.Map <IList <Garage> >(garages);

            return(Ok(model));
        }
Beispiel #3
0
        public async Task <IActionResult> Index()
        {
            try
            {
                var model = new GarageListViewModel()
                {
                    RootUrl = BaseRootUrl,
                    Garages = await _garageService.GetGarages()
                };

                return(View(model));
            }
            catch (Exception ex)
            {
                ex.ToExceptionless().Submit();
                return(BadRequest());
            }
        }
Beispiel #4
0
        public async Task <ActionResult> GetGarages([FromQuery] string vehiculo, [FromQuery] int?localidad)
        {
            try
            {
                List <GarageDto> garageList = await _garageService.GetGarages(vehiculo, localidad);

                return(Response.Ok(garageList));
            }
            catch (BaseException e)
            {
                _logger.LogInformation(ExceptionHandlerHelper.ExceptionMessageStringToLogger(e));
                return(Response.HandleExceptions(e));
            }
            catch (Exception e)
            {
                _logger.LogError(e, GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
                return(Response.InternalServerError());
            }
        }
Beispiel #5
0
        public IActionResult Index()
        {
            var allGarages = _garageService.GetGarages();

            return(View(_mapper.Map <List <GarageViewModel> >(allGarages)));
        }