Skip to content

Commit 7ff7bfb

Browse files
committed
Updating README and MAUI project
1 parent 384b839 commit 7ff7bfb

8 files changed

Lines changed: 293 additions & 276 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For feature requests and enhancements, open an issue first to discuss the change
2424

2525
Pull requests are the best way to propose changes to the project. They allow us to review your modifications before merging them into the main branch. Please follow these steps to create a pull request:
2626

27-
1. Fork the Project Repository.
27+
1. Fork the Project Repository, *Note* Fork from `develop` branch.
2828
2. Create a new branch for your changes.
2929
3. Commit your changes to the new branch.
3030
4. Push your branch to GitHub.

README.md

Lines changed: 261 additions & 249 deletions
Large diffs are not rendered by default.

sample/CountryData.Sample.Console/Program.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void Main()
2121
GetRegionsByCountryCode("US");
2222
GetCountryFlag("US");
2323
GetPhoneCodeByCountryShortCode("AF");
24-
GetCountryByPhoneCode("93");
24+
GetCountryByPhoneCode("+233");
2525

2626

2727
}
@@ -107,10 +107,14 @@ static void GetPhoneCodeByCountryShortCode(string shortCode)
107107
/// <param name="phoneCode">The phone code.</param>
108108
static void GetCountryByPhoneCode(string phoneCode)
109109
{
110-
var country = _helper.GetCountriesByPhoneCode(phoneCode);
111-
Console.WriteLine($"Country for phone code {phoneCode}:");
112-
Console.WriteLine(country.FirstOrDefault());
110+
var countries = _helper.GetCountriesByPhoneCode(phoneCode);
111+
Console.WriteLine($"Countries for phone code {phoneCode}:");
112+
foreach (var country in countries)
113+
{
114+
Console.WriteLine(country.CountryName);
115+
}
113116
}
114117

115118

119+
116120
}

sample/CountryData.Sample.MAUI/CountryData.Sample.MAUI/MainPage.xaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
<CollectionView.ItemTemplate>
1111
<DataTemplate x:DataType="{x:Type country:Country}">
1212
<ContentView>
13-
<Grid ColumnDefinitions="Auto,30,*"
13+
<Grid ColumnDefinitions="Auto,45,*"
1414
Margin="5"
15+
1516
ColumnSpacing="5">
1617
<Label Text="{Binding CountryFlag}"
18+
Margin="20,0,0,0"
1719
FontSize="Large"/>
1820

1921
<Label Grid.Column="1"
20-
Text="{Binding CountryShortCode}"/>
22+
23+
Text="{Binding PhoneCode}"
24+
Margin="5,0,0,0"
25+
/>
2126

2227
<Label Grid.Column="2"
2328
HorizontalTextAlignment="Start"

sample/CountryData.Sample.MAUI/CountryData.Sample.MAUI/ViewModels/MainViewModel.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
using CountryData.Standard;
22
using ReactiveUI;
33
using ReactiveUI.Fody.Helpers;
4-
using System;
5-
using System.Collections.Generic;
64
using System.Collections.ObjectModel;
7-
using System.Linq;
8-
using System.Text;
9-
using System.Threading.Tasks;
105

116
namespace CountryData.Sample.MAUI.ViewModels
127
{

sample/CountryData.Sample.Web.API/Controllers/CountryController.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public IActionResult GetCountries()
4040
/// </summary>
4141
/// <param name="countryCode">The ISO country code.</param>
4242
/// <returns>The data for the specified country. If no data is found, a NotFound result is returned.</returns>
43-
[HttpGet("{countryCode}/countries")]
44-
public IActionResult GetCountryByCode(string countryCode)
43+
[HttpGet("country")]
44+
public IActionResult GetCountryByCode([FromQuery] string countryCode)
4545
{
4646
var country = _helper.GetCountryByCode(countryCode);
4747
if (country == null)
@@ -79,8 +79,8 @@ public IActionResult GetCountryData()
7979
/// </summary>
8080
/// <param name="countryCode">The ISO country code.</param>
8181
/// <returns>A list of regions for the specified country. If no regions are found, a NotFound result is returned.</returns>
82-
[HttpGet("{countryCode}/regions")]
83-
public IActionResult GetRegionsByCountryCode(string countryCode)
82+
[HttpGet("regions")]
83+
public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
8484
{
8585
var regions = _helper.GetRegionByCountryCode(countryCode);
8686
if (regions == null)
@@ -97,8 +97,8 @@ public IActionResult GetRegionsByCountryCode(string countryCode)
9797
/// </summary>
9898
/// <param name="shortCode">The short code of the country.</param>
9999
/// <returns>The emoji flag for the specified country. If no flag is found, a NotFound result is returned.</returns>
100-
[HttpGet("{shortCode}/flag")]
101-
public IActionResult GetCountryFlag(string shortCode)
100+
[HttpGet("flag")]
101+
public IActionResult GetCountryFlag([FromQuery] string shortCode)
102102
{
103103
var flag = _helper.GetCountryEmojiFlag(shortCode);
104104
if (flag == null)
@@ -115,8 +115,8 @@ public IActionResult GetCountryFlag(string shortCode)
115115
/// </summary>
116116
/// <param name="shortCode">The short code of the country.</param>
117117
/// <returns>The phone code for the specified country. If no phone code is found, a NotFound result is returned.</returns>
118-
[HttpGet("{shortCode}/phoneCode")]
119-
public IActionResult GetPhoneCodeByCountryShortCode(string shortCode)
118+
[HttpGet("phoneCodeByShortCode")]
119+
public IActionResult GetPhoneCodeByCountryShortCode([FromQuery] string shortCode)
120120
{
121121
var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
122122
if (phoneCode == null)
@@ -132,20 +132,20 @@ public IActionResult GetPhoneCodeByCountryShortCode(string shortCode)
132132
/// </summary>
133133
/// <param name="phoneCode">The phone code of the country.</param>
134134
/// <returns>The data for the specified country. If no data is found, a NotFound result is returned.</returns>
135-
[HttpGet("phoneCode/{phoneCode}")]
136-
public IActionResult GetCountryByPhoneCode(string phoneCode)
135+
[HttpGet("countryByPhoneCode")]
136+
public IActionResult GetCountryByPhoneCode([FromQuery] string phoneCode)
137137
{
138-
var country = _helper.GetCountriesByPhoneCode(phoneCode);
139-
if (country == null)
138+
var countryDataByPhoneCode = _helper.GetCountriesByPhoneCode(phoneCode);
139+
if (countryDataByPhoneCode == null)
140140
{
141141
return NotFound();
142142
}
143143

144-
return Ok(country);
144+
return Ok(countryDataByPhoneCode);
145145
}
146146

147147

148148

149149

150150
}
151-
}
151+
}

sample/CountryData.Sample.Web.API/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626

2727
app.MapControllers();
2828

29-
app.Run();
29+
app.Run();

test/CountryData.UnitTests/CountryData.UnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PackageReference Include="CountryData.Standard" Version="1.3.0" />
1212
<PackageReference Include="FluentAssertions" Version="6.12.0" />
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
14+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen.ConventionalRouting" Version="4.3.0" />
1415
<PackageReference Include="xunit" Version="2.4.1" />
1516
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1617
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

0 commit comments

Comments
 (0)