Exemple #1
0
        public ActionResult Calendar(decimal groupId)
        {
            var group = GroupService.GetByPK(groupId);

            if (group == null)
            {
                return(null);
            }
            var lectures = LectureService.GetAll(x => x.Group_ID == groupId).ToList();

            if (!lectures.Any())
            {
                lectures.Add(new Lecture {
                    LectureDateBeg = group.DateBeg.Value,
                    LectureDateEnd = group.DateEnd.Value
                });
            }
            var result = EntityUtils.GetCalendar(lectures.Select(x =>
                                                                 new CalData(x.LectureDateBeg, x.LectureDateEnd,
                                                                             group.Complex.GetOrDefault(z => z.Address), group.Title)).ToList());
            var encoding = new System.Text.UTF8Encoding();

            return(File(encoding.GetBytes(result), "text/calendar",
                        "group" + groupId + ".ics"));
        }
Exemple #2
0
        public void SetUpdateDateAndChanger(T e)
        {
            var user       = AuthService.CurrentUser;
            var employeeTC = user.Employee_TC;

            if (employeeTC.IsEmpty())
            {
                throw new Exception("employee_tc is null");
            }
            EntityUtils.SetUpdateDateAndLastChanger(e, employeeTC);
        }
Exemple #3
0
        public ActionResult Prerequisite(decimal courseId)
        {
            var course             = CourseService.FirstOrDefault(x => x.Course_ID == courseId);
            var courseTC           = course.Course_TC;
            var coursePrerequisite = CoursePrerequisiteService.GetForCourse(courseTC).FirstOrDefault();

            if (coursePrerequisite == null)
            {
                return(null);
            }
            TestService.LoadWith(x => x.Author);
            var test       = TestService.GetByPK(coursePrerequisite.Test_ID);
            var preCourses = EntityUtils.GetCoursePreCourses(CoursePrerequisiteService, courseTC)
                             .Select(x => x.RequiredCourse).ToList();
            var model = new PrerequisiteTestVM {
                Test = test,
                CoursePrerequisite  = coursePrerequisite,
                Course              = course,
                PrerequisiteCourses = preCourses
            };

            return(BaseView(Views.Test.Prerequisite, model));
        }