Beispiel #1
0
 public void SaveLack(Lacks lack)
 {
     try
     {
         db.Lacks.Add(lack);
         db.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "IdLack,Date,IdCourse,IdStudent,IdSubject,IdTeacher,IdJustification")] Lacks lacks)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(lacks).State = EntityState.Modified;
         //db.SaveChanges();
         //return RedirectToAction("Index");
     }
     ViewBag.IdTeacher = new SelectList(validationUser.GetAllTeachers(), "Id", "Email", lacks.IdTeacher);
     ViewBag.IdCourse  = new SelectList(validationsCourse.GetAllCourses(), "IdCourse", "Description", lacks.IdCourse);
     ViewBag.IdStudent = new SelectList(validationStudents.GetAllStudents(), "IdStudent", "Names", lacks.IdStudent);
     ViewBag.IdSubject = new SelectList(validationsSubject.GetAllSubjects(), "IdSubjects", "name", lacks.IdSubject);
     return(View(lacks));
 }
Beispiel #3
0
        // GET: Lacks/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Lacks lacks = validationsLacks.FindById(id);

            if (lacks == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdTeacher = new SelectList(validationUser.GetAllTeachers(), "Id", "Email", lacks.IdTeacher);
            ViewBag.IdCourse  = new SelectList(validationsCourse.GetAllCourses(), "IdCourse", "Description", lacks.IdCourse);
            ViewBag.IdStudent = new SelectList(validationStudents.GetAllStudents(), "IdStudent", "Names", lacks.IdStudent);
            ViewBag.IdSubject = new SelectList(validationsSubject.GetAllSubjects(), "IdSubjects", "name", lacks.IdSubject);
            return(PartialView(lacks));
        }
Beispiel #4
0
 public bool SaveLacks(List <Students> fails, int idCourse, int idSubject, DateTime today, string user)
 {
     try
     {
         foreach (Students student in fails)
         {
             Lacks lack = new Lacks
             {
                 IdCourse  = idCourse,
                 IdTeacher = user,
                 IdSubject = idSubject,
                 Date      = today,
                 IdStudent = student.IdStudent
             };
             SaveLack(lack);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }