Ejemplo n.º 1
0
        public ActionResult DeleteClass(int classId)
        {
            Class @class = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId);

            foreach (Student student in @class.students)
            {
                GetHelper <Class> .Remove(Globals.CLASSES_REMOVE_API_LINK, classId, student.id);
            }

            DeleteHelper.DeleteEntity(Globals.CLASSES_API_LINK, classId);

            TempData["message"] = "Pomyślnie usunięto klasę " + @class.name + " o id: " + classId;
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult RemoveStudentFromClass(int classId, int studentId)
        {
            GetHelper <Class> .Remove(Globals.CLASSES_REMOVE_API_LINK, classId, studentId);

            var className = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId).name;

            Student student = GetHelper <Student> .GetById(Globals.STUDENTS_API_LINK, studentId);

            var studentName = student.forename + " " + student.surname;

            TempData["message"] = "Pomyślnie usunięto studenta " + studentName + " z klasy " + className;

            return(RedirectToAction("Index"));
        }