Exemple #1
0
            public async Task <string> Handle(Query request, CancellationToken cancellationToken)
            {
                var lecture = _context.Lectures.Where(x => x.CourseName.Equals(request.Title));

                if (lecture.Count() <= 0)
                {
                    var ex = new DataObjectNotFoundException(nameof(lecture));

                    LogMethods.LogError("Lecture not found", ex, request.Logger);

                    throw ex;
                }

                var report = new LectureReport()
                {
                    LectureTitle = lecture.First().CourseName,
                    //Students = lecture.Students.Select(x => x.Name).ToList()
                    Students = new List <string> {
                        "Test", "AGA"
                    }
                };

                var xmlSer = new XmlSerializer(report.GetType());

                using (var stream = new MemoryStream())
                {
                    xmlSer.Serialize(stream, report);
                    stream.Position  = 0;
                    using var reader = new StreamReader(stream);
                    return(await reader.ReadToEndAsync());
                }
            }
Exemple #2
0
 public LecturePanel()
 {
     m_dataPanel   = new LectureDataPanel();
     m_searchPanel = new LectureSearchPanel(m_dataPanel);
     m_report      = new LectureReport();
     base.init();
 }