Example #1
0
        public void UploadFiles(IList<string> files, int taskId, int uploaderId)
        {
            Task task = session.Load<Task>(taskId);
            User uploader = session.Load<User>(uploaderId);
            task.Attachments = task.Attachments ?? new List<Attachment>();

            foreach (string attachment in files)
            {
                Attachment att = new Attachment
                {
                    Task = task,
                    Uploader = uploader,
                    FileName = Path.GetFileName(attachment)
                };
                task.Attachments.Add(att);
            }
        }
Example #2
0
 public static void FilledBy(this AttachmentModel model, Attachment attachment)
 {
     model.FileName = attachment.FileName;
     model.Uploader = new UserModel();
     model.Uploader.FilledBy(attachment.Uploader);
 }