Example #1
0
        public async Task <IActionResult> AddImg(AddImgToModelForm carModel)
        {
            await this.cars.ChangeModelImgAsync(carModel.Make, carModel.Model, carModel.ImageUrl);

            var id = await this.cars.GetMakeIdByNameAsync(carModel.Make);

            TempData.AddSuccessMessage($"You successfully added image to {carModel.Make} {carModel.Model}!");

            return(RedirectToAction(nameof(Index), new { id }));
        }
Example #2
0
        public async Task <IActionResult> DeleteImg(AddImgToModelForm carModel)
        {
            await this.cars.DeleteImageAsync(carModel.Make, carModel.Model);

            var id = await this.cars.GetMakeIdByNameAsync(carModel.Make);

            TempData.AddSuccessMessage($"You successfully deleted image from {carModel.Make} {carModel.Model}!");

            return(RedirectToAction(nameof(Index), new { id }));
        }