コード例 #1
0
        public ActionResult Semester(string publicDivisionAlias, int studentGroupId, int?autumn)
        {
            var studentGroup   = studentGroupRepository.GetStudentGroupById(studentGroupId);
            var publicDivision = publicDivisionRepository.GetPublicDivisionByAlias(publicDivisionAlias);

            if (studentGroup != null)
            {
                var viewModel = StudentGroupEventsSemesterViewModel.Build(studentGroup, publicDivision, autumn);

                return(View(viewModel.ViewName, viewModel));
            }
            return(View());
        }
コード例 #2
0
        public FileStreamResult ExcelSemester(string publicDivisionAlias, int studentGroupId, int?autumn)
        {
            var studentGroup   = studentGroupRepository.GetStudentGroupById(studentGroupId);
            var publicDivision = publicDivisionRepository.GetPublicDivisionByAlias(publicDivisionAlias);

            if (studentGroup != null)
            {
                var viewModel = StudentGroupEventsSemesterViewModel.Build(studentGroup, publicDivision, autumn);
                return(File(
                           GetXmlContentAsStream(studentGroup, viewModel),
                           "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                           $"расписание {studentGroup.Name} {(viewModel.IsSpringSemester ? "весенний": "осенний")} семестр {studentGroup.CurrentStudyYear.DisplayName}.xlsx"));
            }
            return(null);
        }