コード例 #1
0
 public ContentResult ToContentResult(
     long id,
     long referenceId,
     string binaryType,
     string guid,
     string extension,
     long size,
     long creator,
     long updator,
     string createdTime,
     string updatedTime
     )
 {
     return(ApiResults.Get(new
     {
         Id = id,
         StatusCode = 200,
         Message = FileDownloadName + "を取得しました。",
         Response = new
         {
             ReferenceId = referenceId,
             BinaryType = binaryType,
             Base64 = GetBase64Content(),
             Guid = guid,
             FileName = FileDownloadName,
             Extension = extension,
             Size = size,
             ContentType,
             Creator = creator,
             Updator = updator,
             CreatedTime = createdTime,
             UpdatedTime = updatedTime
         }
     }.ToJson()));
 }
コード例 #2
0
        public static ContentResult DownloadByApi(Context context, string guid)
        {
            DataRow dataRow = GetBinariesTable(context, guid);

            return(dataRow != null
                ? Bytes(dataRow).ToContentResult(
                       id: dataRow.Long("BinaryId"),
                       referenceId: dataRow.Long("ReferenceId"),
                       binaryType: dataRow.String("BinaryType"),
                       guid: dataRow.String("Guid"),
                       extension: dataRow.String("Extension"),
                       size: dataRow.Long("Size"),
                       creator: dataRow.Long("Creator"),
                       updator: dataRow.Long("Updator"),
                       createdTime: dataRow.String("CreatedTime"),
                       updatedTime: dataRow.String("UpdatedTime"))
                : ApiResults.Error(
                       context: context,
                       errorData: new ErrorData(type: Error.Types.NotFound)));
        }