Gold.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Microsoft.AspNetCore.Mvc;
  2. using System.ComponentModel.DataAnnotations;
  3. namespace economy.Models.Gold
  4. {
  5. /*
  6. * KRX금시장에 상장된 금상품의 시세 정보를 제공
  7. * 예시 ) https://apis.data.go.kr/1160100/service/GetGeneralProductInfoService/getGoldPriceInfo?serviceKey=vQz8tIxrdhjerG6DE1w1hcVEli5S27LtIsCvx0axiieZmRgOpB4vToQ77VmvknAkIC9YjxlPx2gDZcl06S88Xw%3D%3D&resultType=json&beginBasDt=20241010&endBasDt=20241012&pageNo=1&numOfRows=10
  8. */
  9. // 검색요청 변수
  10. public class Request
  11. {
  12. [BindProperty(Name = "page", SupportsGet = true)]
  13. [Range(1, int.MaxValue, ErrorMessage = "페이지 허용량을 초과하였습니다.")]
  14. public int PageNo { get; set; } = 1;
  15. [BindProperty(Name = "perPage", SupportsGet = true)]
  16. [Range(1, int.MaxValue, ErrorMessage = "출력 허용량을 초과하였습니다.")]
  17. public int NumOfRows { get; set; } = 10;
  18. [BindProperty(Name = "code", SupportsGet = true)]
  19. [StringLength(10, ErrorMessage = "품목코드 형식이 잘못되었습니다.")]
  20. public string? LikeSrtnCd { get; set; }
  21. [BindProperty(Name = "sDate", SupportsGet = true)]
  22. [Required(ErrorMessage = "검색 시작날짜를 입력해주세요.")]
  23. [DataType(DataType.Date)]
  24. [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
  25. public DateTime StartDate { get; set; } = DateTime.Now.AddDays(-5);
  26. [BindProperty(Name = "eDate", SupportsGet = true)]
  27. [Required(ErrorMessage = "검색 종료날짜를 입력해주세요.")]
  28. [DataType(DataType.Date)]
  29. [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
  30. public DateTime EndDate { get; set; } = DateTime.Now;
  31. }
  32. }