public async Task DeleteAsync(Picture pictureEntity) { dbSet.Remove(pictureEntity); context.Entry(pictureEntity).State = EntityState.Deleted; await context.SaveChangesAsync(); // Deletes the image from the database string imagePath = PictureDataHelpers.GeneratePictureFilePath(wwwRootPath, pictureEntity.FileName); // Gets the picture path File.Delete(imagePath); // Deletes the image from the file system }
public void InsertIntoFileSystem(Picture pictureEntity, Bitmap bmp) { string imagePath = PictureDataHelpers.GeneratePictureFilePath(wwwRootPath, pictureEntity.FileName); bmp.Save(imagePath); }