public ActionResult Edit(FestivalViewModel festivalViewModel) { if (ModelState.IsValid) { FestivalServices.Update(festivalViewModel); return(RedirectToAction("Index")); } ViewBag.ReligionId = new SelectList(FestivalServices.GetAll(), "ReligionId", "ReligionName", festivalViewModel.ReligionId); return(View(festivalViewModel)); }
public void Create(FestivalViewModel festivalViewModel) { var Festival = new Festival { FestivalName = festivalViewModel.FestivalName, ReligionId = festivalViewModel.ReligionId }; unitOfWork.FestivalRepository.Insert(Festival); unitOfWork.Save(); }
// GET: Festival/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FestivalViewModel festivalViewModel = FestivalServices.GetByID(id); if (festivalViewModel == null) { return(HttpNotFound()); } return(View(festivalViewModel)); }
private void DeleteSelectedClient() { if (!DBContext.IsOnline) { MessageBox.Show("Application is in offline mode.", "Offline Mode"); return; } // Prevents application from crashing whenever someone tries to delete a client, when there's none selected. TODO: Hide the buttons when there's no client selected after updates. if (_selectedCustomerCompany != null) { var confirmResult = MessageBox.Show("Bent u zeker dat u " + SelectedCustomerCompany.NameCompany.ToString() + " wenst te verwijderen?", "Klanten verwijder waarchuwing", MessageBoxButton.YesNo); if (confirmResult == MessageBoxResult.Yes) { SelectedCustomerCompany.IsArchived = true; RaisePropertyChanged("SelectedCustomerCompany"); SelectedCustomerCompany.Update(); SelectedCustomerCompany = null; SelectedFestival = null; RefreshView(); } } }
internal void LoadQuestionList(FestivalViewModel selectedFestival) { SwitchView = 0; _sfestival = selectedFestival ?? throw new ArgumentNullException(nameof(selectedFestival)); QuestionList = new ObservableCollection <QuestionListVM>(selectedFestival.QuestionLists.Select(q => new QuestionListVM(q))); }
public AddInspectionView(FestivalViewModel fvm) { InitializeComponent(); ((FestivalListViewModel)DataContext).SelectedFestival = fvm; }