Skip to content

Commit a8ee98c

Browse files
Merge pull request #4 from Backiaraj/dropdown
Update the project from older version to latest version (using .NET 7 Framework)
2 parents 8b30bd0 + 7ca4a85 commit a8ee98c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1638
-1560
lines changed

App.razor

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
2-
<Found Context="routeData">
3-
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4-
</Found>
5-
<NotFound>
6-
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
8-
</LayoutView>
9-
</NotFound>
10-
</Router>
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>

Controllers/RegionController.cs

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using EFDropDown.Shared.DataAccess;
6-
using EFDropDown.Shared.Models;
7-
using Microsoft.AspNetCore.Mvc;
8-
9-
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
10-
11-
namespace EFDropDown.Controllers
12-
{
13-
14-
[Route("api/Region")]
15-
public class RegionController : Controller
16-
{
17-
DataAccessLayer db = new DataAccessLayer();
18-
19-
[HttpGet]
20-
[Route("GetRegion")]
21-
public IEnumerable<Region> GetRegion()
22-
{
23-
return db.GetAllRegion().AsQueryable();
24-
}
25-
26-
[HttpGet]
27-
[Route("GetTerritories")]
28-
public IEnumerable<Territories> GetTerritories()
29-
{
30-
return db.GetAllTerritoriesData().AsQueryable();
31-
}
32-
33-
// GET: api/<controller>
34-
[HttpGet]
35-
public IEnumerable<Region> Get()
36-
{
37-
return db.GetAllRegion().AsQueryable();
38-
}
39-
40-
//// GET api/<controller>/5
41-
[HttpGet("{id}")]
42-
public IEnumerable<Territories> Get(int id)
43-
{
44-
return db.GetTerritoriesData(id).AsQueryable();
45-
}
46-
// GET api/<controller>/5
47-
48-
// POST api/<controller>
49-
[HttpPost]
50-
public void Post([FromBody]string value)
51-
{
52-
}
53-
54-
// PUT api/<controller>/5
55-
[HttpPut("{id}")]
56-
public void Put(int id, [FromBody]string value)
57-
{
58-
}
59-
60-
// DELETE api/<controller>/5
61-
[HttpDelete("{id}")]
62-
public void Delete(int id)
63-
{
64-
}
65-
}
66-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using DropDownListWithEF.Shared.DataAccess;
6+
using DropDownListWithEF.Shared.Models;
7+
using Microsoft.AspNetCore.Mvc;
8+
9+
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
10+
11+
namespace DropDownListWithEF.Controllers
12+
{
13+
14+
[Route("api/Region")]
15+
public class RegionController : Controller
16+
{
17+
DataAccessLayer db = new DataAccessLayer();
18+
19+
[HttpGet]
20+
[Route("GetRegion")]
21+
public IEnumerable<Region> GetRegion()
22+
{
23+
return db.GetAllRegion().AsQueryable();
24+
}
25+
26+
[HttpGet]
27+
[Route("GetTerritories")]
28+
public IEnumerable<Territories> GetTerritories()
29+
{
30+
return db.GetAllTerritoriesData().AsQueryable();
31+
}
32+
33+
// GET: api/<controller>
34+
[HttpGet]
35+
public IEnumerable<Region> Get()
36+
{
37+
return db.GetAllRegion().AsQueryable();
38+
}
39+
40+
//// GET api/<controller>/5
41+
[HttpGet("{id}")]
42+
public IEnumerable<Territories> Get(int id)
43+
{
44+
return db.GetTerritoriesData(id).AsQueryable();
45+
}
46+
// GET api/<controller>/5
47+
48+
// POST api/<controller>
49+
[HttpPost]
50+
public void Post([FromBody]string value)
51+
{
52+
}
53+
54+
// PUT api/<controller>/5
55+
[HttpPut("{id}")]
56+
public void Put(int id, [FromBody]string value)
57+
{
58+
}
59+
60+
// DELETE api/<controller>/5
61+
[HttpDelete("{id}")]
62+
public void Delete(int id)
63+
{
64+
}
65+
}
66+
}

Data/WeatherForecast.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
using System;
2-
3-
namespace EFDropDown.Data
4-
{
5-
public class WeatherForecast
6-
{
7-
public DateTime Date { get; set; }
8-
9-
public int TemperatureC { get; set; }
10-
11-
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12-
13-
public string Summary { get; set; }
14-
}
15-
}
1+
namespace DropDownListWithEF.Data
2+
{
3+
public class WeatherForecast
4+
{
5+
public DateOnly Date { get; set; }
6+
7+
public int TemperatureC { get; set; }
8+
9+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
10+
11+
public string? Summary { get; set; }
12+
}
13+
}

Data/WeatherForecastService.cs

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
using System;
2-
using System.Linq;
3-
using System.Threading.Tasks;
4-
5-
namespace EFDropDown.Data
6-
{
7-
public class WeatherForecastService
8-
{
9-
private static readonly string[] Summaries = new[]
10-
{
11-
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12-
};
13-
14-
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
15-
{
16-
var rng = new Random();
17-
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
18-
{
19-
Date = startDate.AddDays(index),
20-
TemperatureC = rng.Next(-20, 55),
21-
Summary = Summaries[rng.Next(Summaries.Length)]
22-
}).ToArray());
23-
}
24-
}
25-
}
1+
namespace DropDownListWithEF.Data
2+
{
3+
public class WeatherForecastService
4+
{
5+
private static readonly string[] Summaries = new[]
6+
{
7+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
8+
};
9+
10+
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
11+
{
12+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
13+
{
14+
Date = startDate.AddDays(index),
15+
TemperatureC = Random.Shared.Next(-20, 55),
16+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
17+
}).ToArray());
18+
}
19+
}
20+
}

DropDownListWithEF.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.14" />
11+
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.2" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.14" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
14+
<PrivateAssets>all</PrivateAssets>
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
</PackageReference>
17+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
18+
<PackageReference Include="Syncfusion.Blazor.DropDowns" Version="24.1.44" />
19+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="24.1.44" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29209.152
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFDropDown", "EFDropDown.csproj", "{DBEAE4B1-FB29-4D74-820A-85DBB8D3AF9E}"
7-
EndProject
8-
Global
9-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10-
Debug|Any CPU = Debug|Any CPU
11-
Release|Any CPU = Release|Any CPU
12-
EndGlobalSection
13-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{DBEAE4B1-FB29-4D74-820A-85DBB8D3AF9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{DBEAE4B1-FB29-4D74-820A-85DBB8D3AF9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{DBEAE4B1-FB29-4D74-820A-85DBB8D3AF9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{DBEAE4B1-FB29-4D74-820A-85DBB8D3AF9E}.Release|Any CPU.Build.0 = Release|Any CPU
18-
EndGlobalSection
19-
GlobalSection(SolutionProperties) = preSolution
20-
HideSolutionNode = FALSE
21-
EndGlobalSection
22-
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {00353A6C-5C01-43D3-B7B3-E4A43C22BD5E}
24-
EndGlobalSection
25-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropDownListWithEF", "DropDownListWithEF.csproj", "{C72CC0DB-9C88-47F8-8792-52F676FE5E12}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C72CC0DB-9C88-47F8-8792-52F676FE5E12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C72CC0DB-9C88-47F8-8792-52F676FE5E12}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C72CC0DB-9C88-47F8-8792-52F676FE5E12}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C72CC0DB-9C88-47F8-8792-52F676FE5E12}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {83F4DAC7-0AFC-4B4E-A301-CC1FD4B4B837}
24+
EndGlobalSection
25+
EndGlobal

EFDropDown.csproj

Lines changed: 0 additions & 27 deletions
This file was deleted.

Pages/Counter.razor

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
@page "/counter"
2-
3-
<h1>Counter</h1>
4-
5-
<p>Current count: @currentCount</p>
6-
7-
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
8-
9-
@code {
10-
int currentCount = 0;
11-
12-
void IncrementCount()
13-
{
14-
currentCount++;
15-
}
16-
}
1+
@page "/counter"
2+
3+
<PageTitle>Counter</PageTitle>
4+
5+
<h1>Counter</h1>
6+
7+
<p role="status">Current count: @currentCount</p>
8+
9+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
10+
11+
@code {
12+
private int currentCount = 0;
13+
14+
private void IncrementCount()
15+
{
16+
currentCount++;
17+
}
18+
}

0 commit comments

Comments
 (0)