C# and ASP package to receive and search countries and Iran's provinces, cities, districts, counties, towns and villages and use in selections, dropdown list and also Api requests
Json Files: files
استان (ایران) | شهرستان (ایران) | بخش (ایران) | شهر (ایران) | دهستان (ایران) | آبادی (ایران) | کشور |
---|---|---|---|---|---|---|
۳۱ | ۴۴۸ | ۱۰۹۹ | ۱۵۵۴/۱۳۵۴ | ۲۶۳۷ | ۹۸۱۰۰ | 269 |
In this version: you can get all IRANS provinces, cities, districts, counties, towns and villages
or search for them
Also its includes countries list with their iso , domain , enName , faName , fips
--- there is no relation between tables
.net standard 2.0
Use the library as dll, reference from nuget or use this in your package manager console
Install-Package Iran.AspNet.CountryDivisions
After deploying your project be sure to give all permission to the Data Folder on your Server
you only need to add two things
... Recomended ...
//Startup.cs
public void ConfigureServices(IServiceCollection services)
{
//...
services.AddIranCountryDivisions();
}
//Controller
private readonly IIranCountryDivisions _iranCountryDivisions;
public TestController(IIranCountryDivisions iranCountryDivisions)
{
_iranCountryDivisions = iranCountryDivisions;
}
or :
//...
IIranCountryDivisions _iranCountryDivisions = new IranCountryDivisions(new Iran.AspNet.CountryDivisions.Data.DatabaseContext.LocationsDbContext());
//...
then you can use it like this :
(تمام شهر ها داخل جدول شهرستان ها میباشد ، پس بهتر است همیشه با جدول شهرستان ها به عنوان لیست کامل شهر ها کار بکنید )
//...
var allOstans = await _iranCountryDivisions.GetOstansAsync();
var ostansWithSearchAndOrderByAndCount = await _iranCountryDivisions.GetOstansAsync(p => p.Name.Contains(nameSearch), o=>o.OrderBy(p=>p.Name) , 10);
var allAbadis = await _iranCountryDivisions.GetAbadisAsync();
var abadisWithSearch = await _iranCountryDivisions.GetAbadisAsync(p => p.ShahrestanId == shahrId && p.Name.Contains(nameSearch));
//...
same for others
Ahmad Azizi and his IRAN database
sh4rifi and his COUNTRIES database
the package will be updated base on their databases