Example #1
0
        public IActionResult PhotoDelete(PhotoDeleteDto photoDeleteDto)
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", photoDeleteDto.Url);

            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
                return(NoContent());
            }
            return(BadRequest());
        }
Example #2
0
        public IActionResult DeletePhoto(PhotoDeleteDto photoDeleteDto)
        {
            if (photoDeleteDto.PhotoUrl == null)
            {
                return(BadRequest("Wrong photo url"));
            }
            var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", photoDeleteDto.PhotoUrl);

            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
                return(NoContent());
            }
            return(BadRequest());
        }