示例#1
0
        public IActionResult DeleteConfirmed(int id, string ZdjecieUrl)
        {
            var car = _carRepository.GetCar(id);

            _carRepository.DeleteCaR(car);

            //delete file
            if (ZdjecieUrl != null)
            {
                var webRoot  = _env.WebRootPath;
                var filePath = Path.Combine(webRoot.ToString() + ZdjecieUrl);
                System.IO.File.Delete(filePath);
            }
            return(RedirectToAction(nameof(Cars)));
        }