forked from gavilanch/BlazorMovies
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6424c07
Showing
36 changed files
with
1,885 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29411.138 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorMovies.Server", "BlazorMovies\Server\BlazorMovies.Server.csproj", "{F062FE80-2058-4B93-951D-4AB7DBD2433A}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorMovies.Client", "BlazorMovies\Client\BlazorMovies.Client.csproj", "{3D88005C-4782-4D96-9455-B8E1058E979F}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorMovies.Shared", "BlazorMovies\Shared\BlazorMovies.Shared.csproj", "{059D92BC-D342-4024-B56D-B277F96C399B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F062FE80-2058-4B93-951D-4AB7DBD2433A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F062FE80-2058-4B93-951D-4AB7DBD2433A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F062FE80-2058-4B93-951D-4AB7DBD2433A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F062FE80-2058-4B93-951D-4AB7DBD2433A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{3D88005C-4782-4D96-9455-B8E1058E979F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3D88005C-4782-4D96-9455-B8E1058E979F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3D88005C-4782-4D96-9455-B8E1058E979F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3D88005C-4782-4D96-9455-B8E1058E979F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{059D92BC-D342-4024-B56D-B277F96C399B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{059D92BC-D342-4024-B56D-B277F96C399B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{059D92BC-D342-4024-B56D-B277F96C399B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{059D92BC-D342-4024-B56D-B277F96C399B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {C02675A3-D4AD-4C32-B1DC-4218255FD823} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Router AppAssembly="@typeof(Program).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
</Found> | ||
<NotFound> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p>Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<RazorLangVersion>3.0</RazorLangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview1.19508.20" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview1.19508.20" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview1.19508.20" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview1.19508.20" PrivateAssets="all" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Shared\BlazorMovies.Shared.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace BlazorMovies.Client.Helpers | ||
{ | ||
public class StringUtilities | ||
{ | ||
public static string CustomToUpper(string value) => value.ToUpper(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@page "/counter" | ||
|
||
<h1>Counter</h1> | ||
|
||
<p>Current count: @currentCount</p> | ||
|
||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
|
||
@code { | ||
private int currentCount = 0; | ||
|
||
private void IncrementCount() | ||
{ | ||
currentCount++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@page "/fetchdata" | ||
@using BlazorMovies.Shared | ||
@inject HttpClient Http | ||
|
||
<h1>Weather forecast</h1> | ||
|
||
<p>This component demonstrates fetching data from the server.</p> | ||
|
||
@if (forecasts == null) | ||
{ | ||
<p><em>Loading...</em></p> | ||
} | ||
else | ||
{ | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Temp. (C)</th> | ||
<th>Temp. (F)</th> | ||
<th>Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var forecast in forecasts) | ||
{ | ||
<tr> | ||
<td>@forecast.Date.ToShortDateString()</td> | ||
<td>@forecast.TemperatureC</td> | ||
<td>@forecast.TemperatureF</td> | ||
<td>@forecast.Summary</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
|
||
@code { | ||
private WeatherForecast[] forecasts; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("WeatherForecast"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@page "/" | ||
|
||
<p>Hello, @StringUtilities.CustomToUpper(name)</p> | ||
|
||
<p>Let's add 2 + 2 = @(2 + 2)</p> | ||
|
||
<button @onclick="@WriteInLog">Click me</button> | ||
|
||
<div> | ||
<h3>Movie</h3> | ||
@if (movies == null) | ||
{ | ||
<text>Loading...</text> | ||
} | ||
else | ||
{ | ||
@foreach (var movie in movies) | ||
{ | ||
<p>Title: @((MarkupString)movie.Title)</p> | ||
<p>Release Date: <b>@movie.ReleaseDate.ToString("dd MMM yyyy")</b></p> | ||
} | ||
|
||
@for (var i = 0; i < movies.Count; i++) | ||
{ | ||
<div style="background-color: @(i % 2 == 0 ? "blue" : "red")"> | ||
<p>@(i + 1)) Title: <b>@movies[i].Title</b></p> | ||
<p>Release Date: <b>@movies[i].ReleaseDate.ToString("dd MMM yyyy")</b></p> | ||
</div> | ||
} | ||
} | ||
</div> | ||
|
||
@code{ | ||
string name = "Julia"; | ||
|
||
List<Movie> movies; | ||
|
||
protected async override Task OnInitializedAsync() | ||
{ | ||
await Task.Delay(3000); | ||
movies = new List<Movie>() | ||
{ | ||
new Movie(){Title = "<b>Spider-Man: Far From Home</b>", ReleaseDate = new DateTime(2019, 7, 2)}, | ||
new Movie(){Title = "<i>Moana</i>", ReleaseDate = new DateTime(2016, 11, 23)}, | ||
new Movie(){Title = "Inception", ReleaseDate = new DateTime(2010, 7, 16)} | ||
}; | ||
} | ||
|
||
Movie spiderman = new Movie() | ||
{ | ||
Title = "Spider-Man: Far From Home", | ||
ReleaseDate = new DateTime(2019, 7, 2) | ||
}; | ||
|
||
void WriteInLog() | ||
{ | ||
Console.WriteLine("I've been clicked! (from method)"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.AspNetCore.Blazor.Hosting; | ||
|
||
namespace BlazorMovies.Client | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) => | ||
BlazorWebAssemblyHost.CreateDefaultBuilder() | ||
.UseBlazorStartup<Startup>(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Module2/BlazorMovies/Client/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:50272/", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"BlazorMovies.Client": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "http://localhost:50273/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<div class="sidebar"> | ||
<NavMenu /> | ||
</div> | ||
|
||
<div class="main"> | ||
<div class="top-row px-4"> | ||
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a> | ||
</div> | ||
|
||
<div class="content px-4"> | ||
@Body | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<div class="top-row pl-4 navbar navbar-dark"> | ||
<a class="navbar-brand" href="">BlazorMovies</a> | ||
<button class="navbar-toggler" @onclick="ToggleNavMenu"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
</div> | ||
|
||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu"> | ||
<ul class="nav flex-column"> | ||
<li class="nav-item px-3"> | ||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> | ||
<span class="oi oi-home" aria-hidden="true"></span> Home | ||
</NavLink> | ||
</li> | ||
<li class="nav-item px-3"> | ||
<NavLink class="nav-link" href="counter"> | ||
<span class="oi oi-plus" aria-hidden="true"></span> Counter | ||
</NavLink> | ||
</li> | ||
<li class="nav-item px-3"> | ||
<NavLink class="nav-link" href="fetchdata"> | ||
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data | ||
</NavLink> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
@code { | ||
private bool collapseNavMenu = true; | ||
|
||
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; | ||
|
||
private void ToggleNavMenu() | ||
{ | ||
collapseNavMenu = !collapseNavMenu; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="alert alert-secondary mt-4" role="alert"> | ||
<span class="oi oi-pencil mr-2" aria-hidden="true"></span> | ||
<strong>@Title</strong> | ||
|
||
<span class="text-nowrap"> | ||
Please take our | ||
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2100553">brief survey</a> | ||
</span> | ||
and tell us what you think. | ||
</div> | ||
|
||
@code { | ||
// Demonstrates how a parent component can supply parameters | ||
[Parameter] | ||
public string Title { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Microsoft.AspNetCore.Components.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace BlazorMovies.Client | ||
{ | ||
public class Startup | ||
{ | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
} | ||
|
||
public void Configure(IComponentsApplicationBuilder app) | ||
{ | ||
app.AddComponent<App>("app"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@using System.Net.Http | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using Microsoft.AspNetCore.Components.Routing | ||
@using Microsoft.AspNetCore.Components.Web | ||
@using Microsoft.JSInterop | ||
@using BlazorMovies.Client | ||
@using BlazorMovies.Client.Shared | ||
@using BlazorMovies.Client.Helpers | ||
@using BlazorMovies.Shared.Entities |
7 changes: 7 additions & 0 deletions
7
Module2/BlazorMovies/Client/wwwroot/css/bootstrap/bootstrap.min.css
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
Module2/BlazorMovies/Client/wwwroot/css/bootstrap/bootstrap.min.css.map
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.