//GET-Edit
        public async Task <IActionResult> Edit(int id)
        {
            var selectedMake = await vehicleMakeService.GetMakeAsync(id);

            if (selectedMake == null)
            {
                return(RedirectToAction("Error", "Home"));
            }
            else
            {
                return(View(mapper.Map <VehicleMakeViewModel>(selectedMake)));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetMaker(Guid id)
        {
            if (id.Equals(null) || id == Guid.Empty)
            {
                return(BadRequest("Maker don't exsist"));
            }

            var make = await makeService.GetMakeAsync(id);

            if (make == null)
            {
                return(NotFound());
            }

            var mapped = mapper.Map <VehicleMakeDto>(make);

            return(Ok(mapped));
        }