WebAPI(VS2022_Sample)
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace TSRequestAPI.Model
{
public class OrderRequest
{
public required string TsSeq { get; set; }
public required string SysSeq { get; set; }
public required string SysType { get; set; }
public required string UserCompanyID { get; set; }
public required string UserCompanyCode { get; set; }
public required string UserCompanyName { get; set; }
public required string CompanyClientID { get; set; }
public required string CompanyClientCode { get; set; }
public required string CompanyClientName { get; set; }
//public required Byte[] FixFileHash { get; set; }
//public required Byte[] CertificateTSA { get; set; }
//public required Byte[] Token { get; set; }
public required List<OrderRequestFile> File { get; set; }
}
}
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace TSRequestAPI.Model
{
public class OrderRequestFile
{
public required string SysRequestNo { get; set; }
public required string OfficeID { get; set; }
public required string ClientID { get; set; }
public required string FilePath { get; set; }
public required string FileName { get; set; }
public required string FileSize { get; set; }
//public required Byte[] FileHash { get; set; }
}
}
using Microsoft.AspNetCore.Mvc;
using TSRequestAPI.Model;
namespace TSRequestAPI.Controllers
{
[Route("api/order")]
[ApiController]
public class RequestController : ControllerBase
{
[HttpPost]
public ActionResult RequestOrder([FromBody] OrderRequest request)
{
if (request == null)
{
return BadRequest("Invalid request");
}
// ここでリクエストを処理する
// 例えば、データベースに保存するなど
return Ok(request);
}
}
}
{
"TsRequestNo": "string",
"SysRequestNo": "string",
"SysType": "string",
"CompanyID": "string",
"CompanyCode": "string",
"CompanyName": "string",
"CompanyClientID": "string",
"CompanyClientCode": "string",
"CompanyClientName": "string",
"file": [
{
"sysRequestNo": "string1",
"filePath": "string1",
"fileName": "string1",
"fileSize": "string1",
},
{ "sysRequestNo": "string2",
"filePath": "string2",
"fileName": "string2",
"fileSize": "string2",
},]
}