public async Task <IActionResult> Index() { var items = await _todoItemService.GetIncompleteItemsAsync(); var model = new TodoViewModels() { Items = items }; return(View(model)); }
public async Task <IActionResult> Index() { // Get to-do items from database // Put items into a model // Render view using the model var items = await _todoItemService.GetIncompleteItemsAsync(); var model = new TodoViewModels() { Items = items }; return(View(model)); }
protected override void OnNavigatedTo(NavigationEventArgs e) { ViewModel = TodoViewModels.GetInstance(Icon); if (e.NavigationMode == NavigationMode.New) { ApplicationData.Current.LocalSettings.Values.Remove("NewPage"); if (ViewModel.SelectItem == null) { return; } else { CreateBar.Content = "Update"; DeleteAppBarButton.Visibility = Visibility.Visible; Title.Text = ViewModel.SelectItem.title; Detail.Text = ViewModel.SelectItem.description; Date.Date = ViewModel.SelectItem.date; Icon.Source = ViewModel.SelectItem.source; this.filePath = ViewModel.SelectItem.picPath; } } else { if (ApplicationData.Current.LocalSettings.Values.ContainsKey("NewPage")) { var composite = ApplicationData.Current.LocalSettings.Values["NewPage"] as ApplicationDataCompositeValue; Title.Text = (string)composite["title"]; Detail.Text = (string)composite["detail"]; Date.Date = (DateTimeOffset)composite["date"]; ///Icon.Source = (ImageSource)composite["image"]; ///View_Model = (ViewModels.TodoViewModels)composite["viewModel"]; ApplicationData.Current.LocalSettings.Values.Remove("NewPage"); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } } }