Exemple #1
0
        // Permanently dete the file and its database record
        public static async Task DeleteAttachment(this AppDbContext db, Attachment model)
        {
            await model.DeleteFile();

            var attachment = await db.Attachments.FindAsync(model.Id);

            db.Attachments.Remove(attachment);
            await db.SaveChangesAsync();
        }