Ejemplo n.º 1
0
 public CountriesController(
     CountriesDbContext context,
     ICountriesService countriesService)
 {
     this.context          = context;
     this.countriesService = countriesService;
 }
 public async Task <IEnumerable <CountrySubdivisionDto> > GetMatchingCountrySubdivisions(CountrySubdivisionDto countrySubdivision)
 {
     using (var context = new CountriesDbContext())
     {
         return(await context.CountrySubdivisions.Where(countrySubdivisionDto => countrySubdivisionDto.Id != countrySubdivision.Id && countrySubdivisionDto.CountryId == countrySubdivision.CountryId && countrySubdivisionDto.Name == countrySubdivision.Name).ToArrayAsync());
     }
 }
Ejemplo n.º 3
0
        public IQueryable <Continent> ListBoxContinents_GetData()
        {
            CountriesDbContext data = new CountriesDbContext();
            var continents          = data.Continents;

            return(continents.OrderBy(x => x.Id));
        }
Ejemplo n.º 4
0
 public async Task <IEnumerable <CountryDto> > GetMatchingCountries(CountryDto country)
 {
     using (var context = new CountriesDbContext())
     {
         return(await context.Countries.Where(countryDto => countryDto.FullName == country.FullName && countryDto.Alpha2Code == country.Alpha2Code && countryDto.Id != country.Id).ToArrayAsync());
     }
 }
Ejemplo n.º 5
0
        public IQueryable <Country> GridViewCountries_GetData()
        {
            var selectedId = ListBoxContinents.SelectedValue;
            int id         = 0;

            if (selectedId != "")
            {
                id = int.Parse(selectedId);
            }

            CountriesDbContext data = new CountriesDbContext();

            //return data.Countries.OrderBy(x => x.Id);
            return(data.Countries.Where(x => x.ContinentId == id).OrderBy(x => x.Id));
        }
Ejemplo n.º 6
0
        public IQueryable <Town> ListViewTowns_GetData()
        {
            object countryId = null;

            if (this.GridViewCountries.SelectedDataKey != null)
            {
                countryId = this.GridViewCountries.SelectedDataKey.Value;
            }

            int id = 0;

            if (countryId != null)
            {
                id = (int)countryId;
            }

            CountriesDbContext data = new CountriesDbContext();

            //return data.Countries.OrderBy(x => x.Id);
            return(data.Towns.Where(x => x.CountryId == id).OrderBy(x => x.Id));
        }
Ejemplo n.º 7
0
 public static void Initialize()
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <CountriesDbContext, Configuration>());
     CountriesDbContext.Create().Database.Initialize(true);
 }
 public CountriesService(CountriesDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Ejemplo n.º 9
0
 public CountriesController(CountriesDbContext countries)
 {
     _countries = countries;
 }
Ejemplo n.º 10
0
 public CityRepository(CountriesDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public HomeController(ILogger <HomeController> logger, CountriesDbContext context)
 {
     _logger = logger;
     Context = context;
 }
Ejemplo n.º 12
0
 public RegionRepository(CountriesDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 13
0
 public GenericRepository(CountriesDbContext ctx)
 {
     _ctx = ctx;
 }