public static DataForView MakeModelThroughRoot(Tree tree) { DataForView res = new DataForView(); res.Table = tree.ExrtractTableByItem(Tree.RootId); return(res); }
public static DataForView MakeModelThroughItemId(Tree tree, int itemId) { DataForView res = new DataForView(); res.Table = tree.ExrtractTableByItem(itemId); return(res); }
public static DataForView MakeModelThroughNoteId(Tree tree, int noteId) { DataForView res = new DataForView(); res.Table = tree.ExrtractTableByItem(noteId); var last = GetLastSelectedNode(res.Table); if (last != null) { if (last.Type == NodeType.Folder) { res.IsContent = false; } else { Item maybeNote = tree.GetNoteById(noteId).Content; if (maybeNote is Note) { res.IsContent = true; res.Content = ((Note)maybeNote).Content; res.TitleContent = maybeNote.Title; } else { res.IsContent = false; } } } return(res); }
public void TestMakeVM() { var repo = Repository.GetInstance(); var items = repo.GetItems(); var notes = repo.GetNotes(); var vm = new DataForView(); var sel = vm.MakeData(notes, items); }
public ActionResult Table() { var repo = Repository.GetInstance(); DataForView vm = new DataForView(); object str = RouteData?.Values["id"] ?? ""; int id; try { if (Int32.TryParse((string)str, out id)) { return(View(vm.MakeDataThroughItemId(repo.GetNotes(), repo.GetItems(), id))); } } catch { } return(View(vm.MakeData(repo.GetNotes(), repo.GetItems()))); }