Esempio n. 1
0
        public static void AjoutAbsence(BusinessManager bm, int EleveId)
        {
            Absence a = new Absence {
                DateAbsence = DateTime.Now, EleveId = EleveId, Motif = "Flemme"
            };

            bm.AddAbsence(a);
        }
Esempio n. 2
0
        public void AddAbsenceToEleve_ShouldReturnAbsenceId()
        {
            BusinessManager bm    = BusinessManager.GetInstance();
            Eleve           eleve = new Eleve {
                ClassId = 3, DateNaissance = DateTime.Now, Nom = "Embett", Prenom = "Akim"
            };
            int     eleveId = bm.AddEleve(eleve);
            Absence a       = new Absence {
                DateAbsence = DateTime.Now, EleveId = eleveId, Motif = "original"
            };

            Assert.IsNotNull(bm.AddAbsence(a));
        }
        public ActionResult CreateAbsence(int id, Models.AbsenceViewModel formData)
        {
            if (formData.Motif != null && formData.DateAbsence != null)
            {
                BusinessManager bm = BusinessManager.GetInstance();
                bm.AddAbsence(new Absence {
                    EleveId = id, DateAbsence = formData.DateAbsence, Motif = formData.Motif
                });

                return(Redirect("/Home/Students"));
            }

            ViewBag.EleveId = id;
            return(View("CreateAbsence"));
        }
Esempio n. 4
0
        public void DeleteAbsence_ShouldReturnAbsence()
        {
            BusinessManager bm    = BusinessManager.GetInstance();
            Eleve           eleve = new Eleve {
                ClassId = 3, DateNaissance = DateTime.Now, Nom = "Provist", Prenom = "Alain"
            };
            int     eleveId = bm.AddEleve(eleve);
            Absence a       = new Absence {
                DateAbsence = DateTime.Now, EleveId = eleveId, Motif = "Bravo, jamais là celui-là"
            };
            int absenceId = bm.AddAbsence(a);

            a.AbsenceId = absenceId;
            Assert.AreEqual(bm.DeleteAbsence(absenceId), a);
        }