public void UpdateActie() { _groep.CurrentState = new MotivatieGoedgekeurdState(_groep); var model = new ActieViewModel(); model.Id = 1; model.Titel = "Test"; model.Omschrijving = "Actie"; var container = new ActieContainer(); _groep.AddContainer(container); var actie = new Actie("Test", "Actie"); container.VoegActieToe(actie); _actieRepository.Setup(c => c.GetById(1)).Returns(actie); var result = _controller.UpdateActie(_cursist, model); var redirect = result as ViewResult; _actieRepository.Verify(a => a.SaveChanges(), Times.Once); Assert.Equal("MaakActie", redirect?.ViewName); }
public BeheerOndernemerPage() { ondernemingViewModel = new OndernemingenViewModel(); actieViewModel = new ActieViewModel(); evenementViewModel = new EvenementViewModel(); this.InitializeComponent(); Initialize(); }
public void VoegActieToeGeenContainer() { _groep.CurrentState = new MotivatieGoedgekeurdState(_groep); var model = new ActieViewModel(); _controller.ActieMaken(_cursist); model.Titel = "Test"; model.Omschrijving = "Test"; var result = _controller.VoegActieToe(_cursist, model) as ViewResult; Assert.Equal("MaakActie", result?.ViewName); _actieRepository.Verify(a => a.SaveChanges(), Times.Once); }
public void VoegActieToeAfgekeurdeContainer() { _groep.CurrentState = new MotivatieGoedgekeurdState(_groep); var model = new ActieViewModel(); var container = new ActieContainer(); container.Beoordeeld = true; _groep.AddContainer(container); _controller.ActieMaken(_cursist); model.Titel = "Test"; model.Omschrijving = "Test"; _controller.VoegActieToe(_cursist, model); _actieRepository.Verify(a => a.SaveChanges(), Times.Once); }
public ActionResult CorrectAntwoord(Groep groep, ActieViewModel actieViewModel) { int welkeToegangscode = ControleerVooruitgang(groep.Id); var toegangscodeInput = actieViewModel.ToegangsCode; var mergeallToegangscode = _mergeallRepository.GetBy(groep.Id); Mergeall m = mergeallToegangscode.ElementAt(welkeToegangscode - 1); string mergeallActieCode = m.Actiecode.ToString(); if (toegangscodeInput == mergeallActieCode) { return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(CorrectAntwoord))); }
public IActionResult UpdateActie(Cursist cursist, ActieViewModel model) { Groep groep = cursist.Groep; if (ModelState.IsValid) { Actie actie = _actieRepository.GetById(model.Id); actie.Titel = model.Titel; actie.Omschrijving = model.Omschrijving; _actieRepository.SaveChanges(); ViewBag._userMessage = "Actie is succesvol gewijzigd"; return(ActieMaken(cursist)); } ViewBag._userError = "Gelieve alle velden correct in te vullen"; return(ActieMaken(cursist)); }
public void VoegActieToeMetContainer() { _groep.CurrentState = new MotivatieGoedgekeurdState(_groep); var model = new ActieViewModel(); var container = new ActieContainer(); _groep.AddContainer(container); _controller.ActieMaken(_cursist); model.Titel = "Test"; model.Omschrijving = "Test"; _controller.VoegActieToe(_cursist, model); _actieRepository.Verify(a => a.SaveChanges(), Times.Once); Assert.Equal(container, _groep.GeefLaatsteContainer()); }
public ActionResult CorrectAntwoord(Sessie sessie, Groep groep) { int welkeActie = ControleerVooruitgang(groep.Id); _mergealls = _mergeallRepository.GetBy(groep.Id); var actieNamen = _boxRepository.GetActiesByBoxNaam(sessie.BoxNaam); if (welkeActie > actieNamen.Count()) { return(RedirectToAction(nameof(SessieAfgelopen))); } if (sessie.Afstandsonderwijs.Value) { return(RedirectToAction(nameof(Index))); } var actieNaam = actieNamen.ElementAt(welkeActie - 1); var actie = _actieRepository.GetBy(actieNaam); ActieViewModel actieViewModel = new ActieViewModel(actie); return(View(actieViewModel)); }
public IActionResult VoegActieToe(Cursist cursist, ActieViewModel model) { Groep groep = cursist.Groep; if (ModelState.IsValid) { try { var actie = new Actie(model.Titel, model.Omschrijving); groep.VoegActieToe(actie); _actieRepository.SaveChanges(); ViewBag._userMessage = $"Actie {actie.Titel} is succesvol toegevoegd"; return(ActieMaken(cursist)); } catch (ArgumentException e) { ViewBag._userError = e.Message; return(ActieMaken(cursist)); } } ViewBag._userError = "Gelieve alle velden correct in te vullen"; return(ActieMaken(cursist)); }
public ActieToevoegenPage() { this.InitializeComponent(); actieViewModel = new ActieViewModel(); }