Esempio n. 1
0
        public async Task <ActionResult <Currency> > GetCurrency(int id)
        {
            var currency = _currenciesManager.GetCurrencyById(id);

            if (currency == null)
            {
                return(NotFound());
            }

            return(Ok(_mapper.Map <IEnumerable <CurrencyDTO> >(currency)));
        }
Esempio n. 2
0
 public ActionResult GetCurrency(string id) // id = currency id
 {
     try
     {
         if (Guid.TryParse(id, out Guid currencyId) && CurrenciesManager.CurrencyExists(currencyId))
         {
             return(Json(CurrenciesManager.GetCurrencyById(currencyId), JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
         }
     }
     catch
     {
         return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
     }
 }