public ActionResult List(IntList ids) { var attachments = new PaginatedList <AttachmentInfo>(ids .Select(x => SchoolLocator.AttachementService.GetAttachmentById(x)) .Select(x => SchoolLocator.AttachementService.TransformToAttachmentInfo(x)) , 0, ids.Count); return(Json(attachments.Transform(x => AttachmentViewData.Create(x, Context)))); }
public ActionResult AttachmentsList(string filter, int?sortType, int?start, int?count) { start = start ?? 0; count = count ?? 10; var attachments = SchoolLocator.AttachementService.GetAttachmentsInfo(filter, (AttachmentSortTypeEnum?)sortType, start.Value, count.Value); return(Json(attachments .Transform(x => AttachmentViewData.Create(x, Context)))); }
private AttachmentViewData UploadAttachment(string fileName, byte[] bin) { if (!Context.SchoolId.HasValue || !Context.DistrictId.HasValue) { return(UploadForSysAdmin(fileName, bin)); } Trace.Assert(Context.PersonId.HasValue); var attachment = SchoolLocator.AttachementService.Upload(fileName, bin); var res = SchoolLocator.AttachementService.TransformToAttachmentInfo(attachment, new List <int> { Context.PersonId.Value }); return(AttachmentViewData.Create(res, Context, true)); }
public static AnnouncementAssignedAttributeViewData Create(AnnouncementAssignedAttribute attr, AttachmentInfo attachmentInfo) { var result = new AnnouncementAssignedAttributeViewData { Id = attr.Id, Name = attr.Name, Text = attr.Text, AttributeTypeId = attr.AttributeTypeId, VisibleForStudents = attr.VisibleForStudents, AnnouncementRef = attr.AnnouncementRef, SisActivityAssignedAttributeId = attr.SisActivityAssignedAttributeId, AttributeAttachment = attachmentInfo != null?AttachmentViewData.Create(attachmentInfo) : null }; return(result); }