Delete thumb file
This commit is contained in:
parent
afb8a23588
commit
0f5cbb4d87
@ -96,6 +96,13 @@ namespace MyDarling.Controllers
|
|||||||
figureFile.Delete();
|
figureFile.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string thumbFilePath = $"/Content/{product.Id}/{figure.Id}_thumb.jpg";
|
||||||
|
FileInfo thumbFile = new FileInfo(environment.WebRootPath + thumbFilePath);
|
||||||
|
if (thumbFile.Exists)
|
||||||
|
{
|
||||||
|
thumbFile.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
context.Figures.Remove(figure);
|
context.Figures.Remove(figure);
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
return RedirectToAction("Details", "Products", new { Id = product?.Id });
|
return RedirectToAction("Details", "Products", new { Id = product?.Id });
|
||||||
|
Loading…
Reference in New Issue
Block a user