Esempio 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 := models.DaysList, models.PairsList
		days_out := database.TeacherSchedule(c.DB, teacher.Id, days, pairs)

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