public IActionResult GetById(Guid id) { var item = _storage.FindById(id); var model = new ReminderItemViewModel(item); return(Ok(model)); }
private void EditButton_Click(object sender, System.Windows.RoutedEventArgs e) { ReminderItemViewModel reminder = (sender as Button).DataContext as ReminderItemViewModel; if (reminder != null) { NavigationService.Navigate(new Uri(string.Format("//Views/EditLogbook.xaml?reminderId={0}", Uri.EscapeUriString(reminder.ReminderId.ToString())), UriKind.Relative)); } }
private void ResultsList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { ReminderItemViewModel reminder = (sender as ListBox).SelectedItem as ReminderItemViewModel; if (reminder != null) { // unset the selection (sender as ListBox).SelectedItem = null; reminder.ShowAlt(); } }
public IActionResult Get(Guid id) { try { var item = _storage.Find(id); var result = new ReminderItemViewModel(item); return(Ok(result)); } catch (KeyNotFoundException) { return(BadRequest()); } }
public IActionResult GetById(Guid id) { if (id == default) { return(BadRequest()); } var item = _storage.FindById(id); if (item == default) { return(NotFound()); } var model = new ReminderItemViewModel(item); return(Ok(model)); }
private void InitializePage() { if (App.ViewModel.DefaultVehicle.Reminders.Count(r => (r.RemindDate && r.RemindOdo)) > 0) { DefaultHelp.Visibility = Visibility.Visible; } else { DefaultHelp.Visibility = Visibility.Collapsed; } ObservableCollection <ReminderItemViewModel> resultsModel = new ObservableCollection <ReminderItemViewModel>(); foreach (ReminderModel r in App.ViewModel.DefaultVehicle.Reminders) { ReminderItemViewModel ReminderView = new ReminderItemViewModel(r); resultsModel.Add(ReminderView); } ResultsList.ItemsSource = resultsModel; }