Rozvrh.Exporters.ImportExport.DownloadAsICAL C# (CSharp) Method

DownloadAsICAL() public method

Exports lectures to ICal format.
public DownloadAsICAL ( List lectures, System.DateTime semStart, System.DateTime semEnd ) : System.Web.Mvc.ActionResult
lectures List List of lectures.
semStart System.DateTime Beginning of the semester. Only Year, Month and Day are used.
semEnd System.DateTime End of the semester. Only Year, Month and Day are used.
return System.Web.Mvc.ActionResult
        public ActionResult DownloadAsICAL(List<TimetableField> lectures,DateTime semStart, DateTime semEnd)
        {
            ICalGenerator gen = new ICalGenerator();
            string text = gen.generateICal(lectures, semStart, semEnd);
            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(text);
            var res = new FileContentResult(buffer, "text/plain");
            res.FileDownloadName = "FJFIRozvrh.ical";
            return res;
        }

Usage Example

Ejemplo n.º 1
0
 public ActionResult ExportToICal()
 {
     ImportExport instance = new ImportExport();
     return instance.DownloadAsICAL(M.CustomTimetableFields, M.SelectedTimetable.m_timetableInfo.SemesterStart, M.SelectedTimetable.m_timetableInfo.SemesterEnd);
 }