Iran.AspNet.CountryDivisions
The Countries List and Irans regions and divisions including a list of all provinces, cities, districts, counties, towns, and villages which you can search and access with LINQ syntax
Install / Use
/learn @keyone2693/Iran.AspNet.CountryDivisionsREADME

Iran.AspNet.CountryDivisions
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
Development
Json Files: files
Current version: 2.1.x [Stable]
| استان (ایران) | شهرستان (ایران) | بخش (ایران) | شهر (ایران) | دهستان (ایران) | آبادی (ایران) | کشور | | --- | --- | --- | --- | --- | --- | --- | | ۳۱ | ۴۴۸ | ۱۰۹۹ | ۱۵۵۴/۱۳۵۴ | ۲۶۳۷ | ۹۸۱۰۰ | 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
Easy to install
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
Wiki
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
Special thanks
Ahmad Azizi and his IRAN database
sh4rifi and his COUNTRIES database
the package will be updated base on their databases
Related Skills
node-connect
353.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
