Пример #1
0
 public CountryCMSResponseViewModel GetAllCountries()
 {
     try
     {
         CountryCMSResponseViewModel      countryCMSResponseViewModel = new CountryCMSResponseViewModel();
         List <Contracts.Models.Country>  countries  = AutoMapper.Mapper.Map <List <Contracts.Models.Country> >(_countryRepository.GetAll(null).ToList());
         List <Contracts.Models.Currency> currencies = AutoMapper.Mapper.Map <List <Contracts.Models.Currency> >(_currencyRepository.GetAll(null).ToList());
         List <Contracts.Models.Language> languages  = AutoMapper.Mapper.Map <List <Contracts.Models.Language> >(_languageRepository.GetAll(null).ToList());
         List <Contracts.Models.CountryLanguageMapping> countryLanguageMappings = AutoMapper.Mapper.Map <List <Contracts.Models.CountryLanguageMapping> >(_countryLanguageMappingRepository.GetAll(null).ToList());
         List <Contracts.Models.CountryCurrencyMapping> countryCurrencyMappings = AutoMapper.Mapper.Map <List <Contracts.Models.CountryCurrencyMapping> >(_countryCurrencyMappingRepository.GetAll(null).ToList());
         return(new CountryCMSResponseViewModel {
             Countries = countries,
             Currencies = currencies,
             Languages = languages,
             CountryCurrencyMappings = countryCurrencyMappings,
             CountryLanguageMappings = countryLanguageMappings
         });
     }
     catch (Exception)
     {
     }
     return(null);
 }
Пример #2
0
 public CountryDetailResponseViewModel GetCountryDetails(Guid altId)
 {
     try
     {
         CountryDetailResponseViewModel   countryCMSResponseViewModel = new CountryDetailResponseViewModel();
         Contracts.Models.Country         country    = AutoMapper.Mapper.Map <Contracts.Models.Country>(_countryRepository.GetByAltId(altId));
         List <Contracts.Models.Currency> currencies = AutoMapper.Mapper.Map <List <Contracts.Models.Currency> >(_currencyRepository.GetAll(null).ToList());
         List <Contracts.Models.Language> languages  = AutoMapper.Mapper.Map <List <Contracts.Models.Language> >(_languageRepository.GetAll(null).ToList());
         List <Contracts.Models.CountryLanguageMapping> countryLanguageMappings = AutoMapper.Mapper.Map <List <Contracts.Models.CountryLanguageMapping> >(_countryLanguageMappingRepository.GetAll(null).Where(w => w.CountryId == country.Id).ToList());
         List <Contracts.Models.CountryCurrencyMapping> countryCurrencyMappings = AutoMapper.Mapper.Map <List <Contracts.Models.CountryCurrencyMapping> >(_countryCurrencyMappingRepository.GetAll(null).Where(w => w.CountryId == country.Id).ToList());
         return(new CountryDetailResponseViewModel
         {
             Country = country,
             Currencies = currencies,
             Languages = languages,
             CountryCurrencyMappings = countryCurrencyMappings,
             CountryLanguageMappings = countryLanguageMappings
         });
     }
     catch (Exception)
     {
     }
     return(null);
 }