예제 #1
0
        public async Task <IHttpActionResult> CreateAsync(CountryDto country)
        {
            _repository.Add(country.Map <Country>());

            await _unitOfWork.CompleteAsync();

            return(Created(new Uri(Request.RequestUri + "/" + country.Id), country));
        }
예제 #2
0
        public async Task <IHttpActionResult> UpdateAsync(int id, CountryDto country)
        {
            var countryInDb = await _repository.GetAsync(id);

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

            _repository.Add(country.Map <Country>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }