public async Task <IActionResult> Delete(int id) { FolderModel folder = await _db.Folders .Include(x => x.Folders) .Include(x => x.Files) .FirstOrDefaultAsync(x => x.Id == id); if (folder != null) { _db.DeleteFolderDirectory(folder); await _db.SaveChangesAsync(); return(RedirectToAction("OpenFolder", "FileSystem", new { id = folder.ParentFolderId })); } return(NotFound()); }