public async Task GetAll_ReturnListOfLectures()
        {
            //Act
            var result = await lectureService.GetAll();

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <LectureDetailsModel>));
        }
예제 #2
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"));
        }
예제 #3
0
        public ActionResult GroupFiles(decimal?groupId)
        {
            var lectures   = LectureService.GetAll(x => x.Group_ID == groupId.GetValueOrDefault()).ToList();
            var lectureIds = lectures.Select(x => x.Lecture_ID).ToList();
            var model      = new LectureFilesVM {
                Lectures = lectures,
                GroupId  = groupId,
                Files    = LectureFileService.GetAll(x => lectureIds.Contains(x.Lecture_ID)).ToList()
            };

            return(BaseViewWithModel(new LectureFilesView(), model));
        }
예제 #4
0
        public XDocument Get(UrlHelper urlHelper)
        {
            _url          = urlHelper;
            _directions   = CourseDirectionService.GetAll().ToDictionary(x => x.CourseDirectionA_TC, x => x.DirectionAName);
            _lectureCount = LectureService.GetAll(x =>
                                                  x.Group.DateBeg >= DateTime.Today &&
                                                  Colors.ForSite.Contains(x.Group.Color_TC) &&
                                                  x.Group.LectureType_TC == LectureTypes.Planned)
                            .GroupBy(x => x.Group_ID).Select(x => new { x.Key, Count = x.Count() }).ToList().ToDictionary(x => x.Key, x => x.Count);
            var yaml =
                new XDocument(Programs());

            return(yaml);
        }
예제 #5
0
 // GET: Lectures
 public ActionResult Index()
 {
     return(View(_lectureService.GetAll()));
 }