public ActionResult GetFileSubject(string subjectId) { var lectures = new List <Attachment>(); foreach (var att in SubjectManagementService.GetLecturesAttachments(int.Parse(subjectId))) { lectures.AddRange(FilesManagementService.GetAttachments(att).ToList()); } var labs = new List <Attachment>(); foreach (var att in SubjectManagementService.GetLabsAttachments(int.Parse(subjectId))) { lectures.AddRange(FilesManagementService.GetAttachments(att).ToList()); } var practicals = new List <Attachment>(); foreach (var att in SubjectManagementService.GetPracticalsAttachments(int.Parse(subjectId))) { lectures.AddRange(FilesManagementService.GetAttachments(att).ToList()); } return(new JsonResult() { Data = new { Lectures = this.PartialViewToString("Subjects/Modules/_FilesUploaderNoAdd", lectures), Labs = this.PartialViewToString("Subjects/Modules/_FilesUploaderNoAdd", labs), Practicals = this.PartialViewToString("Subjects/Modules/_FilesUploaderNoAdd", practicals) }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public FileResult GetStudentZipLabs(int id, int subjectId, int userId) { var zip = new ZipFile(Encoding.UTF8); var subGroups = SubjectManagementService.GetSubGroup(id); var subGroup = subGroups.SubjectStudents.FirstOrDefault(e => e.StudentId == userId); var model = SubjectManagementService.GetUserLabFiles(subGroup.StudentId, subjectId); var attachments = new List <Attachment>(); foreach (var data in model) { attachments.AddRange(FilesManagementService.GetAttachments(data.Attachments)); } UtilZip.CreateZipFile(ConfigurationManager.AppSettings["FileUploadPath"], zip, attachments, subGroup.Student.FullName.Replace(" ", "_")); var memoryStream = new MemoryStream(); zip.Save(memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); return(new FileStreamResult(memoryStream, "application/zip") { FileDownloadName = subGroup.Student.FullName.Replace(" ", "_") + ".zip" }); }
public LecturesDataViewModel(Lectures lectures) { Theme = lectures.Theme; LecturesId = lectures.Id; Duration = lectures.Duration; SubjectId = lectures.SubjectId; Order = lectures.Order; PathFile = lectures.Attachments; Attachments = FilesManagementService.GetAttachments(lectures.Attachments); }
public PracticalsViewData(Practical practical) { Theme = practical.Theme; PracticalId = practical.Id; Duration = practical.Duration; SubjectId = practical.SubjectId; Order = practical.Order; PathFile = practical.Attachments; ShortName = practical.ShortName; Attachments = FilesManagementService.GetAttachments(practical.Attachments); }
public LabsViewData(LMP.Models.Labs labs) { Theme = labs.Theme; LabId = labs.Id; Duration = labs.Duration; SubjectId = labs.SubjectId; Order = labs.Order; PathFile = labs.Attachments; ShortName = labs.ShortName; Attachments = FilesManagementService.GetAttachments(labs.Attachments); }
public ActionResult GetFilePracticals(int id) { if (id == 0) { return(PartialView("Common/_FilesUploader", new List <Attachment>())); } var model = SubjectManagementService.GetPractical(id); return(PartialView("Common/_FilesUploader", FilesManagementService.GetAttachments(model.Attachments).ToList())); }
private AttachViewData GetNeighborConceptData(Int32 neighborId) { var neighbor = ConceptManagementService.GetById(neighborId); if (neighbor == null) { return(new AttachViewData(0, String.Empty, null)); } var att = FilesManagementService.GetAttachments(neighbor.Container).FirstOrDefault(); return(new AttachViewData(neighbor.Id, neighbor.Name, att)); }
public LecturesDataViewModel(int id, int subjectId) { SubjectId = subjectId; Attachments = new List <Attachment>(); if (id != 0) { var lectures = SubjectManagementService.GetLectures(id); Order = lectures.Order; Theme = lectures.Theme; Duration = lectures.Duration; LecturesId = id; PathFile = lectures.Attachments; Attachments = FilesManagementService.GetAttachments(lectures.Attachments); } }
public PracticalsDataViewModel(int id, int subjectId) { SubjectId = subjectId; Attachments = new List <Attachment>(); if (id != 0) { var practicals = SubjectManagementService.GetPractical(id); Order = practicals.Order; Theme = practicals.Theme; Duration = practicals.Duration; PracticalId = id; ShortName = practicals.ShortName; PathFile = practicals.Attachments; Attachments = FilesManagementService.GetAttachments(practicals.Attachments); } }
public AddOrEditConceptViewModel(Int32 currentAuthorId, Int32 id) : base(currentAuthorId, id) { if (!IsNew()) { Container = SourceConcept.Container; if (!String.IsNullOrEmpty(Container)) { Attachments = FilesManagementService.GetAttachments(Container); } ParentId = SourceConcept.ParentId.GetValueOrDefault(); IsGroup = SourceConcept.IsGroup; Prev = SourceConcept.PrevConcept; Next = SourceConcept.NextConcept; } //Attachments = new List<Attachment>(); }