public IActionResult Edit(int?id) { ViewData["CurrentStyle"] = style.getCurrent(); if (id == null || id <= 0) { return(NotFound()); } try { Note note = _noteDBContext.Note.Single(n => n.ID == id); return(View(note)); } catch (ArgumentNullException) { return(NotFound()); } catch (InvalidOperationException) { return(NotFound()); } }
public IActionResult Index(string style, string sortOrder, string hideFinished) { if (style != null && !style.Equals(_style.getCurrent())) { _style.change(); } ViewData["CurrentStyle"] = _style.getCurrent(); ViewData["NextStyle"] = _style.getNext(); if (sortOrder != null) { _sortOrder.Set(sortOrder); } ViewData["SortOrderFinishText"] = getSortOrderText("Finish Date", "finish"); ViewData["SortOrderFinishValue"] = getSortOrderValue("finish"); ViewData["SortOrderCreatedText"] = getSortOrderText("Created Date", "created"); ViewData["SortOrderCreatedValue"] = getSortOrderValue("created"); ViewData["SortOrderImportanceText"] = getSortOrderText("Importance", "importance"); ViewData["SortOrderImportanceValue"] = getSortOrderValue("importance"); if (hideFinished != null) { bool hide = hideFinished.Equals("true"); _filter.SetHideFinished(hide); } ViewData["HideFinishedText"] = getHideFinishedText(); ViewData["HideFinishedValue"] = getHideFinishedValue(); //Nodes auslesen Notes viewModelWithNotes = FillModelWithNodes(); return(View(viewModelWithNotes)); }