Beispiel #1
0
        public async Task <IActionResult> AddCountry([FromBody] CountryForCreationDto country)
        {
            if (country == null)
            {
                return(BadRequest());
            }
            var countryToAdd = Mapper.Map <Country>(country);

            _repository.AddCountry(countryToAdd);
            if (!await _repository.Save())
            {
                throw new Exception("Failed");
            }
            return(NoContent());
        }