Detail.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Microsoft.AspNetCore.Mvc;
  2. using System.ComponentModel.DataAnnotations;
  3. namespace economy.Models.Product.Detail
  4. {
  5. /*
  6. * 온라인 수집 가격 정보
  7. * 품목 상세 정보
  8. * 예시 ) http://apis.data.go.kr/1240000/bpp_openapi/getPriceInfo?serviceKey=vQz8tIxrdhjerG6DE1w1hcVEli5S27LtIsCvx0axiieZmRgOpB4vToQ77VmvknAkIC9YjxlPx2gDZcl06S88Xw%3D%3D&itemCode=A011010&startDate=20210220&endDate=20210220&numOfRows=10&pageNo=1
  9. */
  10. // 검색요청 변수
  11. public class Request
  12. {
  13. [BindProperty(Name = "page", SupportsGet = true)]
  14. [Range(1, int.MaxValue, ErrorMessage = "페이지 허용량을 초과하였습니다.")]
  15. public int PageNo { get; set; } = 1;
  16. [BindProperty(Name = "perPage", SupportsGet = true)]
  17. [Range(1, int.MaxValue, ErrorMessage = "출력 허용량을 초과하였습니다.")]
  18. public int NumOfRows { get; set; } = 10;
  19. [BindProperty(Name = "item", SupportsGet = true)]
  20. [Required(ErrorMessage = "품목코드를 입력해주세요.")]
  21. [StringLength(7, ErrorMessage = "품목코드 형식이 잘못되었습니다.")]
  22. public string ItemCode { get; set; }
  23. [BindProperty(Name = "sDate", SupportsGet = true)]
  24. [Required(ErrorMessage = "검색 시작날짜를 입력해주세요.")]
  25. [DataType(DataType.Date)]
  26. [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
  27. public DateOnly StartDate { get; set; } = DateOnly.FromDateTime(DateTime.Now);
  28. [BindProperty(Name = "eDate", SupportsGet = true)]
  29. [Required(ErrorMessage = "검색 종료날짜를 입력해주세요.")]
  30. [DataType(DataType.Date)]
  31. [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
  32. public DateOnly EndDate { get; set; } = DateOnly.FromDateTime(DateTime.Now);
  33. }
  34. }