Exchange.cs 1005 B

1234567891011121314151617181920212223242526272829
  1. using Microsoft.AspNetCore.Mvc;
  2. using System.ComponentModel.DataAnnotations;
  3. namespace economy.Models.Financial.Exchange
  4. {
  5. /*
  6. * 한국수출입은행이 제공하는 환율정보
  7. * 예시 ) https://www.koreaexim.go.kr/site/program/financial/exchangeJSON?authkey=OiZlh6SjbXGBlfbagekBpi6kAE4UyonP&searchdate=20241025&data=AP01
  8. */
  9. // 검색요청 변수
  10. public class Request
  11. {
  12. private DateOnly _date = DateOnly.FromDateTime(DateTime.Now);
  13. [BindProperty(Name = "date", SupportsGet = true)]
  14. [Required(ErrorMessage = "검색 날짜를 입력해주세요.")]
  15. [DataType(DataType.Date)]
  16. [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
  17. public DateOnly Date
  18. {
  19. get => _date;
  20. set => _date = value;
  21. }
  22. // 날짜 형식을 적용하여 문자열로 반환하는 추가 속성
  23. public string DateFormatted => _date.ToString("yyyy-MM-dd");
  24. }
  25. }