Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CSharp 2020 Fall
Course Materials
Commits
0d6c2bef
Commit
0d6c2bef
authored
Oct 30, 2020
by
Andres Käver
Browse files
razor
parent
4d4b663f
Changes
328
Hide whitespace changes
Inline
Side-by-side
demos/RazorPagesDemo/WebApp/Pages/Index.cshtml
0 → 100644
View file @
0d6c2bef
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div
class=
"text-center"
>
<h1
class=
"display-4"
>
Welcome
</h1>
<p>
Learn about
<a
href=
"https://docs.microsoft.com/aspnet/core"
>
building Web apps with ASP.NET Core
</a>
.
</p>
</div>
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/Index.cshtml.cs
0 → 100644
View file @
0d6c2bef
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc.RazorPages
;
using
Microsoft.Extensions.Logging
;
namespace
WebApp.Pages
{
public
class
IndexModel
:
PageModel
{
private
readonly
ILogger
<
IndexModel
>
_logger
;
public
IndexModel
(
ILogger
<
IndexModel
>
logger
)
{
_logger
=
logger
;
}
public
void
OnGet
()
{
}
}
}
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/Privacy.cshtml
0 → 100644
View file @
0d6c2bef
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>
@ViewData["Title"]
</h1>
<p>
Use this page to detail your site's privacy policy.
</p>
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/Privacy.cshtml.cs
0 → 100644
View file @
0d6c2bef
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc.RazorPages
;
using
Microsoft.Extensions.Logging
;
namespace
WebApp.Pages
{
public
class
PrivacyModel
:
PageModel
{
private
readonly
ILogger
<
PrivacyModel
>
_logger
;
public
PrivacyModel
(
ILogger
<
PrivacyModel
>
logger
)
{
_logger
=
logger
;
}
public
void
OnGet
()
{
}
}
}
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/Shared/_Layout.cshtml
0 → 100644
View file @
0d6c2bef
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<title>
@ViewData["Title"] - WebApp
</title>
<link
rel=
"stylesheet"
href=
"~/lib/bootstrap/dist/css/bootstrap.min.css"
/>
<link
rel=
"stylesheet"
href=
"~/css/site.css"
/>
</head>
<body>
<header>
<nav
class=
"navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3"
>
<div
class=
"container"
>
<a
class=
"navbar-brand"
asp-area=
""
asp-page=
"/Index"
>
WebApp
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
".navbar-collapse"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse"
>
<ul
class=
"navbar-nav flex-grow-1"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link text-dark"
asp-area=
""
asp-page=
"/Index"
>
Home
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link text-dark"
asp-area=
""
asp-page=
"/GpsSessions/Index"
>
GpsSessions
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link text-dark"
asp-area=
""
asp-page=
"/GpsLocations/Index"
>
GpsLocations
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link text-dark"
asp-area=
""
asp-page=
"/Privacy"
>
Privacy
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div
class=
"container"
>
<main
role=
"main"
class=
"pb-3"
>
@RenderBody()
</main>
</div>
<footer
class=
"border-top footer text-muted"
>
<div
class=
"container"
>
©
2020 - WebApp -
<a
asp-area=
""
asp-page=
"/Privacy"
>
Privacy
</a>
</div>
</footer>
<script
src=
"~/lib/jquery/dist/jquery.min.js"
></script>
<script
src=
"~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
></script>
<script
src=
"~/js/site.js"
asp-append-version=
"true"
></script>
@RenderSection("Scripts", required: false)
</body>
</html>
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/Shared/_ValidationScriptsPartial.cshtml
0 → 100644
View file @
0d6c2bef
<script
src=
"~/lib/jquery-validation/dist/jquery.validate.min.js"
></script>
<script
src=
"~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
></script>
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/_ViewImports.cshtml
0 → 100644
View file @
0d6c2bef
@using WebApp
@namespace WebApp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Pages/_ViewStart.cshtml
0 → 100644
View file @
0d6c2bef
@{
Layout = "_Layout";
}
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Program.cs
0 → 100644
View file @
0d6c2bef
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
namespace
WebApp
{
public
class
Program
{
public
static
void
Main
(
string
[]
args
)
{
CreateHostBuilder
(
args
).
Build
().
Run
();
}
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
=>
Host
.
CreateDefaultBuilder
(
args
)
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
webBuilder
.
UseStartup
<
Startup
>();
});
}
}
\ No newline at end of file
demos/RazorPagesDemo/WebApp/Properties/launchSettings.json
0 → 100644
View file @
0d6c2bef
{
"iisSettings"
:
{
"windowsAuthentication"
:
false
,
"anonymousAuthentication"
:
true
,
"iisExpress"
:
{
"applicationUrl"
:
"http://localhost:64544"
,
"sslPort"
:
44385
}
},
"profiles"
:
{
"IIS Express"
:
{
"commandName"
:
"IISExpress"
,
"launchBrowser"
:
true
,
"environmentVariables"
:
{
"ASPNETCORE_ENVIRONMENT"
:
"Development"
}
},
"WebApp"
:
{
"commandName"
:
"Project"
,
"launchBrowser"
:
true
,
"applicationUrl"
:
"https://localhost:5001;http://localhost:5000"
,
"environmentVariables"
:
{
"ASPNETCORE_ENVIRONMENT"
:
"Development"
}
}
}
}
demos/RazorPagesDemo/WebApp/Startup.cs
0 → 100644
View file @
0d6c2bef
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
DAL
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.HttpsPolicy
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
namespace
WebApp
{
public
class
Startup
{
public
Startup
(
IConfiguration
configuration
)
{
Configuration
=
configuration
;
}
public
IConfiguration
Configuration
{
get
;
}
// This method gets called by the runtime. Use this method to add services to the container.
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddDbContext
<
ApplicationDbContext
>(
options
=>
options
.
UseSqlServer
(
Configuration
.
GetConnectionString
(
"DefaultConnection"
)));
services
.
AddRazorPages
();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
)
{
if
(
env
.
IsDevelopment
())
{
app
.
UseDeveloperExceptionPage
();
}
else
{
app
.
UseExceptionHandler
(
"/Error"
);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app
.
UseHsts
();
}
app
.
UseHttpsRedirection
();
app
.
UseStaticFiles
();
app
.
UseRouting
();
app
.
UseAuthorization
();
app
.
UseEndpoints
(
endpoints
=>
{
endpoints
.
MapRazorPages
();
});
}
}
}
\ No newline at end of file
demos/RazorPagesDemo/WebApp/WebApp.csproj
0 → 100644
View file @
0d6c2bef
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.9" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DAL\DAL.csproj" />
</ItemGroup>
</Project>
demos/RazorPagesDemo/WebApp/appsettings.Development.json
0 → 100644
View file @
0d6c2bef
{
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
}
}
}
demos/RazorPagesDemo/WebApp/appsettings.json
0 → 100644
View file @
0d6c2bef
{
"ConnectionStrings"
:
{
"DefaultConnection"
:
"Server=barrel.itcollege.ee,1533;User Id=student;Password=Student.Bad.password.0;Database=andres.kaver_razordemo;MultipleActiveResultSets=true;"
},
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
}
},
"AllowedHosts"
:
"*"
}
demos/RazorPagesDemo/WebApp/bin/Debug/netcoreapp3.1/DAL.dll
0 → 100644
View file @
0d6c2bef
File added
demos/RazorPagesDemo/WebApp/bin/Debug/netcoreapp3.1/DAL.pdb
0 → 100644
View file @
0d6c2bef
File added
demos/RazorPagesDemo/WebApp/bin/Debug/netcoreapp3.1/Domain.dll
0 → 100644
View file @
0d6c2bef
File added
demos/RazorPagesDemo/WebApp/bin/Debug/netcoreapp3.1/Domain.pdb
0 → 100644
View file @
0d6c2bef
File added
demos/RazorPagesDemo/WebApp/bin/Debug/netcoreapp3.1/Microsoft.AspNetCore.Razor.Language.dll
0 → 100755
View file @
0d6c2bef
File added
demos/RazorPagesDemo/WebApp/bin/Debug/netcoreapp3.1/Microsoft.Bcl.AsyncInterfaces.dll
0 → 100755
View file @
0d6c2bef
File added
Prev
1
2
3
4
5
6
7
8
9
…
17
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment