Trifon Dinev

Trifon Dinev

  • NA
  • 273
  • 0

accordion from database code first FE and MVC

Apr 20 2013 6:51 PM
Hi,

would you please tell me how to arrange everything so for evey continent I have countries available?

Here are my models
public class Country
    {
        [Key]
        public int CountryId { get; set; }
        public virtual string CountryName { get; set; }
        public virtual string Abbriviation { get; set; }
        public virtual string Area { get; set; }
        public virtual string CountryCode { get; set; }
        public int ContinentId { get; set; }
        public virtual Continent Continent { get; set; }
    }

public class Continent
    {
   
        [Key]
        public int ContinentId { get; set; }
        public string ContinentName { get; set; }
        public List<Country> Countryes { get; set; }
    }

and available data
1Africa
2Antarctica
3Asia
4North America
5South America
6Europe
7Australia and Oceania

1AlgeriaDZAfrica    2131
2AngolaAOAfrica    2441
3BeninBJAfrica    2291
4BotswanaBWAfrica    2671
5British Indian Ocean TerritoryIOAfrica    01
6Burkina FasoBFAfrica    2261
7BurundiBIAfrica    2571
8Côte d'IvoireCIAfrica    NULL1
9CameroonCMAfrica    2371
10Cape Verde IslandsCVAfrica    2381
11Central African RepublicCFAfrica    2361
12ChadTDAfrica    2351
13ComorosKMAfrica    2691
14CongoCGAfrica    01
15Democratic Republic of the CongoCDAfrica    2431
16DjiboutiDJAfrica    2531
17EgyptEGAfrica    201
18Equatorial GuineaGQAfrica    2401
19EritreaERAfrica    2911
20EthiopiaETAfrica    2511
21GabonGAAfrica    2411
22GambiaGMAfrica    2201
23GhanaGHAfrica    2331
24GuineaGNAfrica    2241
25Guinea-BissauGWAfrica    2451
26KenyaKEAfrica    2541
27LesothoLSAfrica    2661
28LiberiaLRAfrica    2311
29LibyaLYAfrica    2181
30MadagascarMGAfrica    2611
31MalawiMWAfrica    2651
32MaliMLAfrica    2231
33MauritaniaMRAfrica    2221
34MauritiusMUAfrica    2301
35MayotteYTAfrica    2621
36MoroccoMAAfrica    2121
37MozambiqueMZAfrica    2581
38NamibiaNAAfrica    2641
39NigerNEAfrica    2271
40NigeriaNGAfrica    2341
41RTunionREAfrica    01
42RwandaRWAfrica    2501
43Saint HelenaSHAfrica    2901
44Sao Tome and PrincipeSTAfrica    2391
45SenegalSNAfrica    2211
46SeychellesSCAfrica    2481
47Sierra LeoneSLAfrica    2321
48SomaliaSOAfrica    2521
49South AfricaZAAfrica    271
50SudanSDAfrica    2491
51SwazilandSZAfrica    2681
52TanzaniaTZAfrica    2551
53TogoTGAfrica    2281
54TunisiaTNAfrica    2161
55UgandaUGAfrica    2561
56Western SaharaEHAfrica    01
57ZambiaZMAfrica    2601
58ZimbabweZWAfrica    2631
59AfghanistanAFAsia      933
60ArmeniaAMAsia      3743
61AzerbaijanAZAsia      9943
62BahrainBHAsia      9733
63BangladeshBDAsia      8803
64BhutanBTAsia      9753
65BruneiBNAsia      6733
66CambodiaKHAsia      8553
67ChinaCNAsia      863
68CyprusCYAsia      3573
69East TimorTLAsia      6703
70GeorgiaGEAsia      9953
71IndiaINAsia      913
72IndonesiaIDAsia      623
73IranIRAsia      983
74IraqIQAsia      9643
75IsraelILAsia      9723
76JapanJPAsia      813
77JordanJOAsia      9623
78KazakhstanKZAsia      73
79KuwaitKWAsia      9653
80KyrgyzstanKGAsia      9963
81LaosLAAsia      8563
82LebanonLBAsia      9613
83MalaysiaMYAsia      603
84MaldivesMVAsia      9603
85MongoliaMNAsia      9763
86MyanmarMMAsia      03
87NepalNPAsia      9773
88OmanOMAsia      9683
89PakistanPKAsia      923
90Palestinian West Bank and GazaPSAsia      9703
91PhilippinesPHAsia      633
92QatarQAAsia      9743
93Saudi ArabiaSAAsia      9663
94SingaporeSGAsia      653
95Sri LankaLKAsia      943
96SyriaSYAsia      9633
97TaiwanTWAsia      8863
98TajikistanTJAsia      9923
99ThailandTHAsia      663
100TurkeyTRAsia      903
101TurkmenistanTMAsia      9933
102United Arab EmiratesAEAsia      9713
103UzbekistanUZAsia      9983
104Viet NamVNAsia      843
105YemenYEAsia      9673
106AnguillaAIAmerica12644
107ArubaAWAmerica2974
108BermudaBMAmerica14414
109British Virgin IslandsVGAmerica12844
110Cayman IslandsKYAmerica13454
111GuadeloupeGPAmerica04
112MartiniqueMQAmerica04
113MontserratMSAmerica16644
114Netherlands AntillesANAmerica5994
115NicaraguaNIAmerica5054
116Puerto RicoPRAmerica14
117Saint Pierre and MiquelonPMAmerica5084
118Turks and Caicos IslandsTCAmerica16494
119Antigua and BarbudaAGAmerica   12684
120BahamasBSAmerica   12424
121BarbadosBBAmerica   12464
122BelizeBZAmerica   5014
123CanadaCAAmerica   14
124Costa RicaCRAmerica   5064
125CubaCUAmerica   534
126DominicaDMAmerica   17674
127Dominican RepublicDOAmerica   18094
128El SalvadorSVAmerica   5034
129GreenlandGLAmerica   2994
130GrenadaGDAmerica   14734
131GuatemalaGTAmerica   5024
132HaitiHTAmerica   5094
133HondurasHNAmerica   5044
134JamaicaJMAmerica   18764
135MexicoMXAmerica   524
136PanamaPAAmerica   5074
137Saint Kitts and NevisKNAmerica   18694
138Saint LuciaLCAmerica   17584
139Saint Vincent and the GrenadinesVCAmerica   17844
140Trinidad and TobagoTTAmerica   18684
141United StatesUSAmerica   14
142ArgentinaARAmerica   545
143BoliviaBOAmerica   5915
144BrazilBRAmerica   555
145ChileCLAmerica   565
146ColombiaCOAmerica   575
147EcuadorECAmerica   5935
148Falkland IslandsFKAmerica   5005
149GuyanaGYAmerica   5925
150Guyane frantaiseGFAmerica   NULL5
151ParaguayPYAmerica   5955
152PeruPEAmerica   515
153SurinameSRAmerica   5975
154U.S. Virgin IslandsVIAmerica   13405
155UruguayUYAmerica   5985
156VenezuelaVEAmerica   585
157AlbaniaALEurope    3556
158AndorraADEurope    3766
159AustriaATEurope    436
160BelarusBYEurope    3756
161BelgiumBEEurope    326
162Bosnia and HerzegovinaBAEurope    3876
163BulgariaBGEurope    3596
164CroatiaHREurope    3856
165Czech RepublicCZEurope    4206
166DenmarkDKEurope    456
167EstoniaEEEurope    3726
168FinlandFIEurope    3586
169FranceFREurope    336
170GermanyDEEurope    496
171GibraltarGIEurope    3506
172GreeceGREurope    306
173Holy See (Vatican City)VAEurope    396
174HungaryHUEurope    366
175IcelandISEurope    3546
176IrelandIEEurope    3536
177ItalyITEurope    396
178LatviaLVEurope    3716
179LiechtensteinLIEurope    4236
180LithuaniaLTEurope    3706
181LuxembourgLUEurope    3526
182MacedoniaMKEurope    3896
183MaltaMTEurope    3566
184MoldovaMDEurope    3736
185MonacoMCEurope    3776
186MontenegroMEEurope    3826
187NetherlandsNLEurope    316
188NorwayNOEurope    476
189PolandPLEurope    486
190PortugalPTEurope    3516
191RomaniaROEurope    406
192Russian FederationRUEurope    76
193San MarinoSMEurope    3786
194SerbiaRSEurope    3816
195SlovakiaSKEurope    4216
196SloveniaSIEurope    3866
197SpainESEurope    346
198SwedenSEEurope    466
199SwitzerlandCHEurope    416
200UkraineUAEurope    3806
201United KingdomGBEurope    446
202American SamoaASPacific   16847
203AustraliaAUPacific   617
204Cook IslandsCKPacific   6827
205FijiFJPacific   6797
206French PolynesiaPFPacific   6897
207GuamGUPacific   16717
208KiribatiKIPacific   6867
209Marshall IslandsMHPacific   6927
210MicronesiaFMPacific   6917
211NauruNRPacific   6747
212New CaledoniaNCPacific   6877
213New ZealandNZPacific   647
214NiueNUPacific   6837
215Norfolk IslandNFPacific   6727
216Northern Mariana IslandsMPPacific   16707
217PalauPWPacific   6807
218Papua New GuineaPGPacific   6757
219PitcairnPNPacific   8707
220SamoaWSPacific   6857
221Solomon IslandsSBPacific   6777
222TokelauTKPacific   6907
223TongaTOPacific   6767
224TuvaluTVPacific   6887
225VanuatuVUPacific   6787
226Wallis and FutunaWFPacific   6817

Thank you.

Answers (2)