Beispiel #1
0
        public CountryResponse Create(CountryViewModel re)
        {
            CountryResponse response = new CountryResponse();

            try
            {
                Country addedCountry = unitOfWork.GetCountryRepository().Create(re.ConvertToCountry());
                unitOfWork.Save();
                response.Country = addedCountry.ConvertToCountryViewModel();
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Country = new CountryViewModel();
                response.Success = false;
                response.Message = ex.Message;
            }

            return(response);
        }