Ejemplo n.º 1
0
func (c Application) TeacherCurrent(teacherName string) revel.Result {
	teacher := models.Teachers{}
	parsedTeacherName := strings.Split(teacherName, "_")
	err := c.DB.Where(&models.Teachers{FirstName: parsedTeacherName[1], LastName: parsedTeacherName[0], MiddleName: parsedTeacherName[2]}).First(&teacher).Error
	if err != nil {
		fmt.Println(err)
		return c.Redirect(Application.Teacher)
	} else {
		faculties, departments, teachers := database.TeachersData(c.DB)
		days, pairs := database.DaysPairsData(c.DB)
		days_out := database.TeacherSchedule(c.DB, teacher.Id, days, pairs)

		return c.Render(faculties, departments, teachers, days, pairs, teacher, days_out)
	}
}
Ejemplo n.º 2
0
func (c Application) Teacher() revel.Result {
	faculties, departments, teachers := database.TeachersData(c.DB)
	days, pairs := database.DaysPairsData(c.DB)
	return c.Render(faculties, departments, teachers, days, pairs)
}