Flower.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Microsoft.AspNetCore.Mvc;
  2. using System.ComponentModel.DataAnnotations;
  3. namespace economy.Models.Price.Domestic.Flower
  4. {
  5. // 부류코드
  6. public enum SearchType : sbyte
  7. {
  8. CutFlower = 1,
  9. FoliagePlants = 2,
  10. Orchilds = 3,
  11. SpringOrchilds = 4
  12. }
  13. /*
  14. * 화훼 경락 일자별 경매정보
  15. * 예시 ) https://flower.at.or.kr/api/returnData.api?kind=f001&serviceKey=sample&baseDate=2018-08-16&flowerGubn=1&dataType=json&countPerPage=999
  16. */
  17. // 검색요청 변수
  18. public class Request
  19. {
  20. [BindProperty(Name = "page", SupportsGet = true)]
  21. [Range(1, int.MaxValue, ErrorMessage = "페이지 허용량을 초과하였습니다.")]
  22. public int PageNo { get; set; } = 1;
  23. [BindProperty(Name = "perPage", SupportsGet = true)]
  24. [Range(1, int.MaxValue, ErrorMessage = "출력 허용량을 초과하였습니다.")]
  25. public int NumOfRows { get; set; } = 10;
  26. [BindProperty(Name = "date", SupportsGet = true)]
  27. [Required(ErrorMessage = "조회 날짜를 입력해주세요.")]
  28. [DataType(DataType.Date)]
  29. [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
  30. public DateTime BaseDate { get; set; } = DateTime.Now;
  31. [BindProperty(Name = "type", SupportsGet = true)]
  32. [Required(ErrorMessage = "부류코드를 입력해주세요.")]
  33. [EnumDataType(typeof(SearchType), ErrorMessage = "부류코드가 잘못되었습니다.")]
  34. public SearchType Type { get; set; } = SearchType.CutFlower;
  35. [BindProperty(Name = "pName", SupportsGet = true)]
  36. [MaxLength(100, ErrorMessage = "품목명은 100자까지 입력가능합니다.")]
  37. public string? PumName { get; set; }
  38. [BindProperty(Name = "gName", SupportsGet = true)]
  39. [MaxLength(100, ErrorMessage = "품종명은 100자까지 입력가능합니다.")]
  40. public string? GoodName { get; set; }
  41. }
  42. }