コード例 #1
0
        public IActionResult ChkCurrXDtT([FromBody] SM.Currency_Exchange x)
        {
            try
            {
                if (x is null)
                {
                    throw new ArgumentNullException("Currency Exchange Object Empty (" + where + ") (CT)");
                }
                if (x.CurrFrom.Length == 3)
                {
                    throw new DataException("Currency From must be 3 digits (" + where + ") (CT)");
                }
                if (x.CurrTo.Length == 3)
                {
                    throw new DataException("Currency To must be 3 digits (" + where + ") (CT)");
                }

                int RcdCntTo = S.ServiceLocator.Instance.Currency_ExchangeService.Check_DateT(new SM.Currency_Exchange(0, x.CurrFrom, x.CurrTo, x.DateFrom, x.DateTo, x.Rate));
                return(ApiControllerHelper.SendOk(this, new ApiResult <int>(HttpStatusCode.OK, null, RcdCntTo), HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                return(ApiControllerHelper.SendError(this, ex));
            }
        }
コード例 #2
0
 public IActionResult Get(int id)
 {
     try
     {
         if (id < 1)
         {
             throw new IndexOutOfRangeException("ID must be greater than 0 (" + where + ") (GET)");
         }
         SM.Currency_Exchange curx = S.ServiceLocator.Instance.Currency_ExchangeService.Get(id);
         return(ApiControllerHelper.SendOk(this, new ApiResult <SM.Currency_Exchange>(HttpStatusCode.OK, null, curx), true));
     }
     catch (Exception ex)
     {
         return(ApiControllerHelper.SendError(this, ex));
     }
 }