public IHttpActionResult PutAddsStudentsToGradeAndClassNumber(int studentId, int gradeId, int classNumberId) { Student student = studentService.GetStudent(studentId); if (student == null) { return(NotFound()); } Grade grade = gradeService.GetGrade(gradeId); if (grade == null) { return(NotFound()); } ClassNumber classNumber = classNumberService.GetClassNumber(classNumberId); if (classNumber == null) { return(NotFound()); } student.Grade = grade; student.ClassNumber = classNumber; studentService.UpdateStudent(studentId, student.FirstName, student.LastName, student.Username, student.Password, student.DateOfBirth, student.YearOfEnrollement, student.Gender); return(Ok(student)); }
public IHttpActionResult DeleteClassNumber(int id) { ClassNumber classNumber = classNumberService.DeleteClassNumber(id); if (classNumber == null) { return(NotFound()); } return(Ok(classNumber)); }
public IHttpActionResult PutClassNumber(int id, ClassNumber classNumber) { ClassNumber updatedClassNumber = classNumberService.UpdateClassNumber(id, classNumber.ClassName); if (updatedClassNumber == null) { return(NotFound()); } return(Ok(updatedClassNumber)); }
public void ClassNumberList() { var list = new List <ClassNumber>(); for (int i = 0; i < size; i++) { var tmp = new ClassNumber(0); list.Add(tmp); } }
public void ClassNumberArray() { var array = new ClassNumber[size]; for (int i = 0; i < size; i++) { var tmp = new ClassNumber(0); array[i] = tmp; } }
public IEnumerable <Teacher> GetTeachersByClassNumber(int classNumberId) { ClassNumber classNumber = db.ClassNumberRepository.GetByID(classNumberId); List <Teacher> teachers = new List <Teacher>(); foreach (Teacher teacher in classNumber.Teachers) { teachers.Add(teacher); } return(teachers); }
public ClassNumber DeleteClassNumber(int id) { ClassNumber classNumber = db.ClassNumberRepository.GetByID(id); if (classNumber != null) { db.ClassNumberRepository.Delete(id); db.Save(); } return(classNumber); }
public IEnumerable <Grade> GetGradesByClassNumber(int classNumberId) { ClassNumber classNumber = db.ClassNumberRepository.GetByID(classNumberId); List <Grade> grades = new List <Grade>(); foreach (Grade grade in classNumber.Grades) { grades.Add(grade); } return(grades); }
public ClassNumber UpdateClassNumber(int id, CLASS_NAME className) { ClassNumber classNumber = db.ClassNumberRepository.GetByID(id); if (classNumber != null) { classNumber.ClassName = className; db.ClassNumberRepository.Update(classNumber); db.Save(); } return(classNumber); }
public void ClassNumberArrayPool() { var arrayPool = ArrayPool <ClassNumber> .Shared; var array = arrayPool.Rent(size); try { for (int i = 0; i < size; i++) { var tmp = new ClassNumber(0); array[i] = tmp; } } finally { arrayPool.Return(array); } }
public IHttpActionResult PutAddsGradesToClassNumbers(int gradeId, int classNumberId) { Grade grade = gradeService.GetGrade(gradeId); if (grade == null) { return(NotFound()); } ClassNumber classNumber = classNumberService.GetClassNumber(classNumberId); if (classNumber == null) { return(NotFound()); } gradeService.UpdateGrade(gradeId, grade.Name); return(Ok(grade)); }
public IEnumerable <Student> GetStudentsByGradeAndClassNumber(int gradeId, int classNumberId) { Grade grade = db.GradeRepository.GetByID(gradeId); ClassNumber classNumber = db.ClassNumberRepository.GetByID(classNumberId); List <Student> students = new List <Student>(); foreach (Student student in grade.Students) { students.Add(student); } foreach (Student student in classNumber.Students) { students.Add(student); } return(students); }
public IHttpActionResult PutAddsTeachersToClasses(int teacherId, int classNumberId) { Teacher teacher = teacherService.GetTeacher(teacherId); if (teacher == null) { return(NotFound()); } ClassNumber classNumber = classNumberService.GetClassNumber(classNumberId); if (classNumber == null) { return(NotFound()); } teacherService.UpdateTeacher(teacherId, teacher.FirstName, teacher.LastName, teacher.Username, teacher.Password, teacher.Qualifications, teacher.YearsOfExperience, teacher.Email); return(Ok(teacher)); }
public IHttpActionResult PostClassNumber(ClassNumber classNumber) { ClassNumber createdClassNumber = classNumberService.CreateClassNumber(classNumber); return(Created("", createdClassNumber)); }
public ClassNumber CreateClassNumber(ClassNumber classNumber) { db.ClassNumberRepository.Insert(classNumber); db.Save(); return(classNumber); }