示例#1
0
 public void removeOpdracht(Opdracht opdracht)
 {
     this.Opdrachten.Remove(opdracht);
 }
示例#2
0
 public void AddOpdracht(Opdracht opdracht)
 {
     this.Opdrachten.Add(opdracht);
 }
        public ActionResult AddOpdracht([Bind(Prefix = "OpdrachtViewModel")]OpdrachtViewModel model, int id)
        {
            if (ModelState.IsValid)
            {
                Opdracht opdracht = new Opdracht();
                opdracht.Title = model.Title;
                opdracht.Omschrijving = model.Omschrijving;
                if (model.Semesters.Equals("Semester 1"))
                {
                    opdracht.IsSemester1 = true;
                    opdracht.IsSemester2 = false;
                }
                else if (model.Semesters.Equals("Semester 2"))
                {
                    opdracht.IsSemester2 = true;
                    opdracht.IsSemester1 = false;
                }
                else
                {
                    opdracht.IsSemester1 = true;
                    opdracht.IsSemester2 = true;
                }
                opdracht.Specialisatie = specialisatieRepository.FindSpecialisatieNaam(model.Specialisatie);
                bedrijfRepository.FindById(id).AddOpdracht(opdracht);

                bedrijfRepository.SaveChanges();
                return RedirectToAction("UserIndex");
            }
            IEnumerable<Specialisatie> specialisaties;
            specialisaties = specialisatieRepository.FindAllSpecialisaties();
            return View(new CreateOpdrachtViewModel(specialisaties, model));
        }