コード例 #1
0
 public static WebApiClasses.Classes.TaskAttachement ToWebApi(TaskAttachement taskAttachement, bool getFileContent = true)
 {
     try
     {
         if (taskAttachement == null)
             return null;
         
         return new WebApiClasses.Classes.TaskAttachement
         {
             Id = taskAttachement.Id,
             FileId = taskAttachement.FileId,
             TaskId = taskAttachement.TaskId,
             AttachedAt = taskAttachement.AttachedAt,
             AttachedBy = taskAttachement.AttachedBy,
             User = User.ToWebApi(taskAttachement.User),
             Comments = taskAttachement.Comments,
             Metadata = taskAttachement.Metadata,
             File = taskAttachement.File.ToWebApi(getFileContent),
             Deleted = taskAttachement.Deleted.HasValue && taskAttachement.Deleted.Value == 1
         };
     }
     catch
     {
         return null;
     }
 }
コード例 #2
0
        private WebApiClasses.Classes.TaskAttachement ToWebApi(TaskAttachement taskAttachement, wpContext context, bool getFileContent = true)
        {
            var mta = ToWebApi(taskAttachement);

            if (mta == null)
                return null;

            mta.File = File.ToWebApi(context.Files.FirstOrDefault(f => f.Id == mta.FileId), getFileContent);

            return mta;
        }