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()); }
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()); }