Example #1
0
        public async Task <IHttpActionResult> Create(ExchangeRateDto exchangeRate)
        {
            _exchangeRateRepository.Add(exchangeRate.Map <ExchangeRate>());

            await UnitOfWork.CompleteAsync();

            return(Created(new Uri(Request.RequestUri + "/" + exchangeRate.Id), exchangeRate));
        }
Example #2
0
        public async Task <IHttpActionResult> UpdateAsync(int id, ExchangeRateDto exchangeRate)
        {
            var exchangeRateInDb = await _exchangeRateRepository.GetAsync(id);

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

            _exchangeRateRepository.Add(exchangeRate.Map <ExchangeRate>());
            await UnitOfWork.CompleteAsync();

            return(Ok());
        }