Example #1
0
        public static void AddNote(BusinessManager bm, int eleveId, string matiere, string appreciation, int noteEleve)
        {
            Note n = new Note();

            n.EleveId      = eleveId;
            n.Matiere      = matiere;
            n.DateNote     = DateTime.Now;
            n.Appreciation = appreciation;
            n.NoteEleve    = noteEleve;
            bm.AddNote(n);
        }
Example #2
0
        public static void CreateAndAddNoteForEleveId(BusinessManager bm, int eleveId)
        {
            Note n = new Note();

            n.EleveId      = eleveId;
            n.Matiere      = "Maths";
            n.DateNote     = DateTime.Now;
            n.Appreciation = "not too bad";
            n.NoteEleve    = 15;
            bm.AddNote(n);
        }
Example #3
0
        public void AddNoteToEleve_ShouldReturnNoteId()
        {
            BusinessManager bm    = BusinessManager.GetInstance();
            Eleve           eleve = new Eleve {
                ClassId = 2, DateNaissance = DateTime.Now, Nom = "Javel", Prenom = "Aude"
            };
            int  eleveId = bm.AddEleve(eleve);
            Note n       = new Note {
                EleveId = eleveId, DateNote = DateTime.Now, Matiere = "Lancer de boue", NoteEleve = 20, Appreciation = "Très impliqué"
            };

            Assert.IsNotNull(bm.AddNote(n));
        }
        public ActionResult CreateNote(int id, Models.NoteViewModel formData)
        {
            if (formData.Appreciation != null && formData.DateNote != null && formData.Matiere != null)
            {
                BusinessManager bm = BusinessManager.GetInstance();
                bm.AddNote(new Note {
                    EleveId = id, Appreciation = formData.Appreciation, DateNote = formData.DateNote, Matiere = formData.Matiere, NoteEleve = formData.NoteEleve
                });

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

            ViewBag.EleveId = id;
            return(View("CreateNote"));
        }
Example #5
0
        public void DeleteNote_ShouldReturnNote()
        {
            BusinessManager bm    = BusinessManager.GetInstance();
            Eleve           eleve = new Eleve {
                ClassId = 3, DateNaissance = DateTime.Now, Nom = "Afritt", Prenom = "Barack"
            };
            int  eleveId = bm.AddEleve(eleve);
            Note n       = new Note {
                EleveId = eleveId, DateNote = DateTime.Now, Matiere = "Course", NoteEleve = 1, Appreciation = "ne peut mieux faire"
            };
            int noteId = bm.AddNote(n);

            n.NoteId = noteId;
            Assert.AreEqual(bm.DeleteNote(noteId), n);
        }
Example #6
0
        public static void CreateMocks(BusinessManager bm)
        {
            Eleve e = new Eleve {
                Nom = "YouThere", Prenom = "Hey", ClassId = 1, DateNaissance = DateTime.Now
            };

            bm.AddEleve(e);

            Eleve e1 = new Eleve {
                Nom = "UnAutre", Prenom = "Eleve", ClassId = 1, DateNaissance = DateTime.Now
            };

            bm.AddEleve(e1);

            Eleve e2 = new Eleve {
                Nom = "Rouana", Prenom = "Marie", ClassId = 2, DateNaissance = DateTime.Now
            };

            bm.AddEleve(e2);

            Eleve e3 = new Eleve {
                Nom = "Terieur", Prenom = "Alain", ClassId = 2, DateNaissance = DateTime.Now
            };

            bm.AddEleve(e3);

            Eleve e4 = new Eleve {
                Nom = "Terieur", Prenom = "Alex", ClassId = 1, DateNaissance = DateTime.Now
            };

            bm.AddEleve(e4);

            Note n = new Note {
                EleveId = 4, Matiere = "Maths", DateNote = DateTime.Now, Appreciation = "not too bad", NoteEleve = 15
            };

            bm.AddNote(n);
        }