Skip to content

Repository files navigation

CountryRegion A cascading dropdown for loading countries and associated states and local governments.

CountryRegion

A cascading dropdown for loading countries and associated states and local governments.

Badges

MIT License

stable release version: version

Nuget package downloads: downloads

Tech Stack

C#, .Net6.0, .NetStandard2.1,

How Do I Get Started

First, install NuGet. Then, install CountryRegion from the package manager console:

NuGet\Install-Package CountryRegion -Version 1.0.10

This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.

Or from the .NET CLI as:

dotnetadd package CountryRegion --version 1.0.10

Finally, import into the file:

usingCountryRegion;

Features

  • Get all countries
  • Get all states
  • Get all local governments
  • Get a country
  • Get a state
  • Get a local government

Sample usage

awaitRegion.Countries();
  • Output
Type
Task<IEnumerable<Response?>>

awaitRegion.GetStates(countryId);
  • Input
ParameterTypeDescription
countryIdintRequired. The id of the country to get the states associated with it
  • Output
Type
Task<IEnumerable<Response?>>

awaitRegion.GetLGAs(countryId,stateId);
  • Input
ParametersTypeDescription
countryId,intRequired. The id of the country to get the local governments from
stateIdintRequired. The id of the state to get the local governments from
  • Output
Type
Task<IEnumerable<Response?>>

awaitRegion.GetCountry(countryId);
  • Input
ParameterTypeDescription
countryIdintRequired. The id of the country to get
  • Output
Type
Task<Response?>

awaitRegion.GetState(countryId,stateId);
  • Input
ParametersTypeDescription
countryId,intRequired. The id of the country to get a state from
stateIdintRequired. The id of the state to get
  • Output
Type
Task<Response?>

awaitRegion.GetLGA(stateId,lgaId);
  • Input
ParametersTypeDescription
stateIdintRequired. The id of the state to get local government from
lgaIdint?Required. The name of the local government in that state
  • Output
Type
Task<Response?>

GetState Extension Method


awaitRegion.GetState(List<dynamic>objs,countryId,stateId);

Retrieves a specific state based on the provided parameters.

Input

ParametersTypeDescription
objsList<dynamic>Required. A list of objects representing the states.
countryIdintRequired. The ID of the country to retrieve the state from.
stateIdintRequired. The ID of the state to retrieve.

Output

Type
Response

GetLGA Extension Method


awaitRegion.GetLGA(List<dynamic>objs,stateId,lgaId);

Retrieves a specific Local Government Area (LGA) based on the provided parameters.

Input

ParametersTypeDescription
objsList<dynamic>Required. A list of objects representing the LGAs.
stateIdintRequired. The ID of the state to retrieve the LGA from.
lgaIdint?The ID of the specific LGA to retrieve (optional). If not provided, its assumed the state has no LGA

Output

Type
Response

Thanks to all Contributors

Maintainers:

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages