├── .gitignore
├── LICENSE
├── Module1
└── HtmlProject
│ ├── index.html
│ └── site.css
├── Module4
├── FunWithMySql
│ ├── .bowerrc
│ ├── .gitignore
│ ├── .vscode
│ │ ├── last.sql
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── Controllers
│ │ ├── AccountController.cs
│ │ ├── HomeController.cs
│ │ └── ManageController.cs
│ ├── Data
│ │ ├── ApplicationDbContext.cs
│ │ └── Migrations
│ │ │ ├── 00000000000000_CreateIdentitySchema.Designer.cs
│ │ │ ├── 00000000000000_CreateIdentitySchema.cs
│ │ │ └── ApplicationDbContextModelSnapshot.cs
│ ├── FunWithMySql.csproj
│ ├── Models
│ │ ├── AccountViewModels
│ │ │ ├── ExternalLoginConfirmationViewModel.cs
│ │ │ ├── ForgotPasswordViewModel.cs
│ │ │ ├── LoginViewModel.cs
│ │ │ ├── RegisterViewModel.cs
│ │ │ ├── ResetPasswordViewModel.cs
│ │ │ ├── SendCodeViewModel.cs
│ │ │ └── VerifyCodeViewModel.cs
│ │ ├── ApplicationUser.cs
│ │ └── ManageViewModels
│ │ │ ├── AddPhoneNumberViewModel.cs
│ │ │ ├── ChangePasswordViewModel.cs
│ │ │ ├── ConfigureTwoFactorViewModel.cs
│ │ │ ├── FactorViewModel.cs
│ │ │ ├── IndexViewModel.cs
│ │ │ ├── ManageLoginsViewModel.cs
│ │ │ ├── RemoveLoginViewModel.cs
│ │ │ ├── SetPasswordViewModel.cs
│ │ │ └── VerifyPhoneNumberViewModel.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── README.md
│ ├── Services
│ │ ├── IEmailSender.cs
│ │ ├── ISmsSender.cs
│ │ └── MessageServices.cs
│ ├── Startup.cs
│ ├── Views
│ │ ├── Account
│ │ │ ├── ConfirmEmail.cshtml
│ │ │ ├── ExternalLoginConfirmation.cshtml
│ │ │ ├── ExternalLoginFailure.cshtml
│ │ │ ├── ForgotPassword.cshtml
│ │ │ ├── ForgotPasswordConfirmation.cshtml
│ │ │ ├── Lockout.cshtml
│ │ │ ├── Login.cshtml
│ │ │ ├── Register.cshtml
│ │ │ ├── ResetPassword.cshtml
│ │ │ ├── ResetPasswordConfirmation.cshtml
│ │ │ ├── SendCode.cshtml
│ │ │ └── VerifyCode.cshtml
│ │ ├── Home
│ │ │ ├── About.cshtml
│ │ │ ├── Contact.cshtml
│ │ │ └── Index.cshtml
│ │ ├── Manage
│ │ │ ├── AddPhoneNumber.cshtml
│ │ │ ├── ChangePassword.cshtml
│ │ │ ├── Index.cshtml
│ │ │ ├── ManageLogins.cshtml
│ │ │ ├── SetPassword.cshtml
│ │ │ └── VerifyPhoneNumber.cshtml
│ │ ├── Shared
│ │ │ ├── Error.cshtml
│ │ │ ├── _Layout.cshtml
│ │ │ ├── _LoginPartial.cshtml
│ │ │ └── _ValidationScriptsPartial.cshtml
│ │ ├── _ViewImports.cshtml
│ │ └── _ViewStart.cshtml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bower.json
│ ├── bundleconfig.json
│ ├── fun.sql
│ ├── global.json
│ ├── web.config
│ └── wwwroot
│ │ ├── css
│ │ ├── site.css
│ │ └── site.min.css
│ │ ├── favicon.ico
│ │ ├── images
│ │ ├── banner1.svg
│ │ ├── banner2.svg
│ │ ├── banner3.svg
│ │ └── banner4.svg
│ │ └── js
│ │ ├── site.js
│ │ └── site.min.js
├── FunWithPostgres
│ ├── .bowerrc
│ ├── .gitignore
│ ├── .vscode
│ │ ├── launch.json
│ │ ├── tasks.json
│ │ └── temp.sql
│ ├── Controllers
│ │ ├── AccountController.cs
│ │ ├── HomeController.cs
│ │ └── ManageController.cs
│ ├── Data
│ │ ├── ApplicationDbContext.cs
│ │ └── Migrations
│ │ │ ├── 00000000000000_CreateIdentitySchema.Designer.cs
│ │ │ ├── 00000000000000_CreateIdentitySchema.cs
│ │ │ └── ApplicationDbContextModelSnapshot.cs
│ ├── FunWithPostgres.csproj
│ ├── Models
│ │ ├── AccountViewModels
│ │ │ ├── ExternalLoginConfirmationViewModel.cs
│ │ │ ├── ForgotPasswordViewModel.cs
│ │ │ ├── LoginViewModel.cs
│ │ │ ├── RegisterViewModel.cs
│ │ │ ├── ResetPasswordViewModel.cs
│ │ │ ├── SendCodeViewModel.cs
│ │ │ └── VerifyCodeViewModel.cs
│ │ ├── ApplicationUser.cs
│ │ └── ManageViewModels
│ │ │ ├── AddPhoneNumberViewModel.cs
│ │ │ ├── ChangePasswordViewModel.cs
│ │ │ ├── ConfigureTwoFactorViewModel.cs
│ │ │ ├── FactorViewModel.cs
│ │ │ ├── IndexViewModel.cs
│ │ │ ├── ManageLoginsViewModel.cs
│ │ │ ├── RemoveLoginViewModel.cs
│ │ │ ├── SetPasswordViewModel.cs
│ │ │ └── VerifyPhoneNumberViewModel.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── README.md
│ ├── Services
│ │ ├── IEmailSender.cs
│ │ ├── ISmsSender.cs
│ │ └── MessageServices.cs
│ ├── Startup.cs
│ ├── Views
│ │ ├── Account
│ │ │ ├── ConfirmEmail.cshtml
│ │ │ ├── ExternalLoginConfirmation.cshtml
│ │ │ ├── ExternalLoginFailure.cshtml
│ │ │ ├── ForgotPassword.cshtml
│ │ │ ├── ForgotPasswordConfirmation.cshtml
│ │ │ ├── Lockout.cshtml
│ │ │ ├── Login.cshtml
│ │ │ ├── Register.cshtml
│ │ │ ├── ResetPassword.cshtml
│ │ │ ├── ResetPasswordConfirmation.cshtml
│ │ │ ├── SendCode.cshtml
│ │ │ └── VerifyCode.cshtml
│ │ ├── Home
│ │ │ ├── About.cshtml
│ │ │ ├── Contact.cshtml
│ │ │ └── Index.cshtml
│ │ ├── Manage
│ │ │ ├── AddPhoneNumber.cshtml
│ │ │ ├── ChangePassword.cshtml
│ │ │ ├── Index.cshtml
│ │ │ ├── ManageLogins.cshtml
│ │ │ ├── SetPassword.cshtml
│ │ │ └── VerifyPhoneNumber.cshtml
│ │ ├── Shared
│ │ │ ├── Error.cshtml
│ │ │ ├── _Layout.cshtml
│ │ │ ├── _LoginPartial.cshtml
│ │ │ └── _ValidationScriptsPartial.cshtml
│ │ ├── _ViewImports.cshtml
│ │ └── _ViewStart.cshtml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bower.json
│ ├── bundleconfig.json
│ ├── global.json
│ ├── web.config
│ └── wwwroot
│ │ ├── css
│ │ ├── site.css
│ │ └── site.min.css
│ │ ├── favicon.ico
│ │ ├── images
│ │ ├── banner1.svg
│ │ ├── banner2.svg
│ │ ├── banner3.svg
│ │ └── banner4.svg
│ │ └── js
│ │ ├── site.js
│ │ └── site.min.js
├── FunWithSqlServer
│ ├── .bowerrc
│ ├── .gitignore
│ ├── .vscode
│ │ ├── launch.json
│ │ ├── settings.json
│ │ └── tasks.json
│ ├── Controllers
│ │ ├── AccountController.cs
│ │ ├── HomeController.cs
│ │ └── ManageController.cs
│ ├── Data
│ │ ├── ApplicationDbContext.cs
│ │ └── Migrations
│ │ │ ├── 00000000000000_CreateIdentitySchema.Designer.cs
│ │ │ ├── 00000000000000_CreateIdentitySchema.cs
│ │ │ └── ApplicationDbContextModelSnapshot.cs
│ ├── FunWithSqlServer.csproj
│ ├── Models
│ │ ├── AccountViewModels
│ │ │ ├── ExternalLoginConfirmationViewModel.cs
│ │ │ ├── ForgotPasswordViewModel.cs
│ │ │ ├── LoginViewModel.cs
│ │ │ ├── RegisterViewModel.cs
│ │ │ ├── ResetPasswordViewModel.cs
│ │ │ ├── SendCodeViewModel.cs
│ │ │ └── VerifyCodeViewModel.cs
│ │ ├── ApplicationUser.cs
│ │ └── ManageViewModels
│ │ │ ├── AddPhoneNumberViewModel.cs
│ │ │ ├── ChangePasswordViewModel.cs
│ │ │ ├── ConfigureTwoFactorViewModel.cs
│ │ │ ├── FactorViewModel.cs
│ │ │ ├── IndexViewModel.cs
│ │ │ ├── ManageLoginsViewModel.cs
│ │ │ ├── RemoveLoginViewModel.cs
│ │ │ ├── SetPasswordViewModel.cs
│ │ │ └── VerifyPhoneNumberViewModel.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── README.md
│ ├── Services
│ │ ├── IEmailSender.cs
│ │ ├── ISmsSender.cs
│ │ └── MessageServices.cs
│ ├── Startup.cs
│ ├── Views
│ │ ├── Account
│ │ │ ├── ConfirmEmail.cshtml
│ │ │ ├── ExternalLoginConfirmation.cshtml
│ │ │ ├── ExternalLoginFailure.cshtml
│ │ │ ├── ForgotPassword.cshtml
│ │ │ ├── ForgotPasswordConfirmation.cshtml
│ │ │ ├── Lockout.cshtml
│ │ │ ├── Login.cshtml
│ │ │ ├── Register.cshtml
│ │ │ ├── ResetPassword.cshtml
│ │ │ ├── ResetPasswordConfirmation.cshtml
│ │ │ ├── SendCode.cshtml
│ │ │ └── VerifyCode.cshtml
│ │ ├── Home
│ │ │ ├── About.cshtml
│ │ │ ├── Contact.cshtml
│ │ │ └── Index.cshtml
│ │ ├── Manage
│ │ │ ├── AddPhoneNumber.cshtml
│ │ │ ├── ChangePassword.cshtml
│ │ │ ├── Index.cshtml
│ │ │ ├── ManageLogins.cshtml
│ │ │ ├── SetPassword.cshtml
│ │ │ └── VerifyPhoneNumber.cshtml
│ │ ├── Shared
│ │ │ ├── Error.cshtml
│ │ │ ├── _Layout.cshtml
│ │ │ ├── _LoginPartial.cshtml
│ │ │ └── _ValidationScriptsPartial.cshtml
│ │ ├── _ViewImports.cshtml
│ │ └── _ViewStart.cshtml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bower.json
│ ├── bundleconfig.json
│ ├── global.json
│ ├── test.sql
│ ├── web.config
│ └── wwwroot
│ │ ├── css
│ │ ├── site.css
│ │ └── site.min.css
│ │ ├── favicon.ico
│ │ ├── images
│ │ ├── banner1.svg
│ │ ├── banner2.svg
│ │ ├── banner3.svg
│ │ └── banner4.svg
│ │ └── js
│ │ ├── site.js
│ │ └── site.min.js
└── FunWithSqlite
│ ├── .bowerrc
│ ├── .gitignore
│ ├── .vscode
│ ├── launch.json
│ └── tasks.json
│ ├── Controllers
│ ├── AccountController.cs
│ ├── HomeController.cs
│ └── ManageController.cs
│ ├── Data
│ ├── ApplicationDbContext.cs
│ └── Migrations
│ │ ├── 00000000000000_CreateIdentitySchema.Designer.cs
│ │ ├── 00000000000000_CreateIdentitySchema.cs
│ │ └── ApplicationDbContextModelSnapshot.cs
│ ├── FunWithSqlite.csproj
│ ├── FunWithSqlite.db
│ ├── Models
│ ├── AccountViewModels
│ │ ├── ExternalLoginConfirmationViewModel.cs
│ │ ├── ForgotPasswordViewModel.cs
│ │ ├── LoginViewModel.cs
│ │ ├── RegisterViewModel.cs
│ │ ├── ResetPasswordViewModel.cs
│ │ ├── SendCodeViewModel.cs
│ │ └── VerifyCodeViewModel.cs
│ ├── ApplicationUser.cs
│ └── ManageViewModels
│ │ ├── AddPhoneNumberViewModel.cs
│ │ ├── ChangePasswordViewModel.cs
│ │ ├── ConfigureTwoFactorViewModel.cs
│ │ ├── FactorViewModel.cs
│ │ ├── IndexViewModel.cs
│ │ ├── ManageLoginsViewModel.cs
│ │ ├── RemoveLoginViewModel.cs
│ │ ├── SetPasswordViewModel.cs
│ │ └── VerifyPhoneNumberViewModel.cs
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── README.md
│ ├── Services
│ ├── IEmailSender.cs
│ ├── ISmsSender.cs
│ └── MessageServices.cs
│ ├── Startup.cs
│ ├── Views
│ ├── Account
│ │ ├── ConfirmEmail.cshtml
│ │ ├── ExternalLoginConfirmation.cshtml
│ │ ├── ExternalLoginFailure.cshtml
│ │ ├── ForgotPassword.cshtml
│ │ ├── ForgotPasswordConfirmation.cshtml
│ │ ├── Lockout.cshtml
│ │ ├── Login.cshtml
│ │ ├── Register.cshtml
│ │ ├── ResetPassword.cshtml
│ │ ├── ResetPasswordConfirmation.cshtml
│ │ ├── SendCode.cshtml
│ │ └── VerifyCode.cshtml
│ ├── Home
│ │ ├── About.cshtml
│ │ ├── Contact.cshtml
│ │ └── Index.cshtml
│ ├── Manage
│ │ ├── AddPhoneNumber.cshtml
│ │ ├── ChangePassword.cshtml
│ │ ├── Index.cshtml
│ │ ├── ManageLogins.cshtml
│ │ ├── SetPassword.cshtml
│ │ └── VerifyPhoneNumber.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ ├── _Layout.cshtml
│ │ ├── _LoginPartial.cshtml
│ │ └── _ValidationScriptsPartial.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bower.json
│ ├── bundleconfig.json
│ ├── global.json
│ ├── web.config
│ └── wwwroot
│ ├── css
│ ├── site.css
│ └── site.min.css
│ ├── favicon.ico
│ ├── images
│ ├── banner1.svg
│ ├── banner2.svg
│ ├── banner3.svg
│ └── banner4.svg
│ └── js
│ ├── site.js
│ └── site.min.js
├── Module5
└── CustomizingVSCode
│ ├── .bowerrc
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── .vscode
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
│ ├── Controllers
│ └── HomeController.cs
│ ├── CustomizingVSCode.csproj
│ ├── Data
│ └── foo.xml
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── README.md
│ ├── Startup.cs
│ ├── Views
│ ├── Home
│ │ ├── About.cshtml
│ │ ├── Contact.cshtml
│ │ └── Index.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ └── _Layout.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bower.json
│ ├── global.json
│ ├── testget.rest
│ ├── tsconfig.json
│ ├── tslint.json
│ ├── web.config
│ └── wwwroot
│ ├── css
│ ├── site.css
│ └── site.min.css
│ ├── favicon.ico
│ ├── images
│ ├── banner1.svg
│ ├── banner2.svg
│ ├── banner3.svg
│ └── banner4.svg
│ └── js
│ ├── person.js
│ ├── person.js.map
│ ├── person.ts
│ ├── site.js
│ └── site.min.js
└── README.md
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Pluralsight Course Code
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Module1/HtmlProject/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test HTML Page
5 |
6 |
7 | Welcome to VS Code
8 | This is fun!
9 |
10 |
--------------------------------------------------------------------------------
/Module1/HtmlProject/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-size: 1.0em;
3 | font-family: sans-serif;
4 | }
--------------------------------------------------------------------------------
/Module4/FunWithMySql/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/.vscode/last.sql:
--------------------------------------------------------------------------------
1 | SELECT * FROM Aspnetusers WHERE Email = 0
--------------------------------------------------------------------------------
/Module4/FunWithMySql/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": ".NET Core Launch (web)",
6 | "type": "coreclr",
7 | "request": "launch",
8 | "preLaunchTask": "build",
9 | "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\FunWithMySql.dll",
10 | "args": [],
11 | "cwd": "${workspaceRoot}",
12 | "stopAtEntry": false,
13 | "internalConsoleOptions": "openOnSessionStart",
14 | "launchBrowser": {
15 | "enabled": true,
16 | "args": "${auto-detect-url}",
17 | "windows": {
18 | "command": "cmd.exe",
19 | "args": "/C start ${auto-detect-url}"
20 | },
21 | "osx": {
22 | "command": "open"
23 | },
24 | "linux": {
25 | "command": "xdg-open"
26 | }
27 | },
28 | "env": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | },
31 | "sourceFileMap": {
32 | "/Views": "${workspaceRoot}/Views"
33 | }
34 | },
35 | {
36 | "name": ".NET Core Attach",
37 | "type": "coreclr",
38 | "request": "attach",
39 | "processId": "${command.pickProcess}"
40 | }
41 | ]
42 | }
--------------------------------------------------------------------------------
/Module4/FunWithMySql/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "command": "dotnet",
4 | "isShellCommand": true,
5 | "args": [],
6 | "tasks": [
7 | {
8 | "taskName": "build",
9 | "args": [
10 | "${workspaceRoot}\\FunWithMySql.csproj"
11 | ],
12 | "isBuildCommand": true,
13 | "problemMatcher": "$msCompile"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace FunWithSqlServer.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore;
7 | using FunWithSqlServer.Models;
8 |
9 | namespace FunWithSqlServer.Data
10 | {
11 | public class ApplicationDbContext : IdentityDbContext
12 | {
13 | public ApplicationDbContext(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | protected override void OnModelCreating(ModelBuilder builder)
19 | {
20 | base.OnModelCreating(builder);
21 | // Customize the ASP.NET Identity model and override the defaults if needed.
22 | // For example, you can rename the ASP.NET Identity table names and more.
23 | // Add your customizations after calling base.OnModelCreating(builder);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/FunWithMySql.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp1.0
5 |
6 | aspnet-FunWithMySql-53bc9b9d-9d6a-45d4-8429-2a2761773502
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class ExternalLoginConfirmationViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/ForgotPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class ForgotPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/LoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class LoginViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [DataType(DataType.Password)]
17 | public string Password { get; set; }
18 |
19 | [Display(Name = "Remember me?")]
20 | public bool RememberMe { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/RegisterViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class RegisterViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | [Display(Name = "Email")]
14 | public string Email { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "Password")]
20 | public string Password { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm password")]
24 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/ResetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class ResetPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
17 | [DataType(DataType.Password)]
18 | public string Password { get; set; }
19 |
20 | [DataType(DataType.Password)]
21 | [Display(Name = "Confirm password")]
22 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
23 | public string ConfirmPassword { get; set; }
24 |
25 | public string Code { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/SendCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class SendCodeViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 |
15 | public string ReturnUrl { get; set; }
16 |
17 | public bool RememberMe { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/AccountViewModels/VerifyCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class VerifyCodeViewModel
10 | {
11 | [Required]
12 | public string Provider { get; set; }
13 |
14 | [Required]
15 | public string Code { get; set; }
16 |
17 | public string ReturnUrl { get; set; }
18 |
19 | [Display(Name = "Remember this browser?")]
20 | public bool RememberBrowser { get; set; }
21 |
22 | [Display(Name = "Remember me?")]
23 | public bool RememberMe { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ApplicationUser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 |
7 | namespace FunWithSqlServer.Models
8 | {
9 | // Add profile data for application users by adding properties to the ApplicationUser class
10 | public class ApplicationUser : IdentityUser
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/AddPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class AddPhoneNumberViewModel
10 | {
11 | [Required]
12 | [Phone]
13 | [Display(Name = "Phone number")]
14 | public string PhoneNumber { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/ChangePasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class ChangePasswordViewModel
10 | {
11 | [Required]
12 | [DataType(DataType.Password)]
13 | [Display(Name = "Current password")]
14 | public string OldPassword { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "New password")]
20 | public string NewPassword { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm new password")]
24 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class ConfigureTwoFactorViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/FactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Models.ManageViewModels
7 | {
8 | public class FactorViewModel
9 | {
10 | public string Purpose { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/IndexViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class IndexViewModel
10 | {
11 | public bool HasPassword { get; set; }
12 |
13 | public IList Logins { get; set; }
14 |
15 | public string PhoneNumber { get; set; }
16 |
17 | public bool TwoFactor { get; set; }
18 |
19 | public bool BrowserRemembered { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/ManageLoginsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Http.Authentication;
6 | using Microsoft.AspNetCore.Identity;
7 |
8 | namespace FunWithSqlServer.Models.ManageViewModels
9 | {
10 | public class ManageLoginsViewModel
11 | {
12 | public IList CurrentLogins { get; set; }
13 |
14 | public IList OtherLogins { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/RemoveLoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class RemoveLoginViewModel
10 | {
11 | public string LoginProvider { get; set; }
12 | public string ProviderKey { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/SetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class SetPasswordViewModel
10 | {
11 | [Required]
12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
13 | [DataType(DataType.Password)]
14 | [Display(Name = "New password")]
15 | public string NewPassword { get; set; }
16 |
17 | [DataType(DataType.Password)]
18 | [Display(Name = "Confirm new password")]
19 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
20 | public string ConfirmPassword { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class VerifyPhoneNumberViewModel
10 | {
11 | [Required]
12 | public string Code { get; set; }
13 |
14 | [Required]
15 | [Phone]
16 | [Display(Name = "Phone number")]
17 | public string PhoneNumber { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 |
8 | namespace FunWithSqlServer
9 | {
10 | public class Program
11 | {
12 | public static void Main(string[] args)
13 | {
14 | var host = new WebHostBuilder()
15 | .UseKestrel()
16 | .UseContentRoot(Directory.GetCurrentDirectory())
17 | .UseIISIntegration()
18 | .UseStartup()
19 | .Build();
20 |
21 | host.Run();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:1048/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "FunWithSqlServer": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "launchUrl": "http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to ASP.NET Core
2 |
3 | We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
4 |
5 | You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016)
6 |
7 | ## This application consists of:
8 |
9 | * Sample pages using ASP.NET Core MVC
10 | * [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
11 | * Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939)
12 |
13 | ## How to
14 |
15 | * [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600)
16 | * [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562)
17 | * [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315)
18 | * [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316)
19 | * [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317)
20 | * [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318)
21 | * [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319)
22 |
23 | ## Overview
24 |
25 | * [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008)
26 | * [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320)
27 | * [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602)
28 | * [Security](https://go.microsoft.com/fwlink/?LinkId=398603)
29 | * [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321)
30 | * [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322)
31 | * [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323)
32 |
33 | ## Run & Deploy
34 |
35 | * [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851)
36 | * [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853)
37 | * [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609)
38 |
39 | We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015)
40 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Services/IEmailSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Services
7 | {
8 | public interface IEmailSender
9 | {
10 | Task SendEmailAsync(string email, string subject, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Services/ISmsSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Services
7 | {
8 | public interface ISmsSender
9 | {
10 | Task SendSmsAsync(string number, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Services/MessageServices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Services
7 | {
8 | // This class is used by the application to send Email and SMS
9 | // when you turn on two-factor authentication in ASP.NET Identity.
10 | // For more details see this link https://go.microsoft.com/fwlink/?LinkID=532713
11 | public class AuthMessageSender : IEmailSender, ISmsSender
12 | {
13 | public Task SendEmailAsync(string email, string subject, string message)
14 | {
15 | // Plug in your email service here to send an email.
16 | return Task.FromResult(0);
17 | }
18 |
19 | public Task SendSmsAsync(string number, string message)
20 | {
21 | // Plug in your SMS service here to send a text message.
22 | return Task.FromResult(0);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Confirm Email";
3 | }
4 |
5 | @ViewData["Title"].
6 |
11 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model ExternalLoginConfirmationViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 | Associate your @ViewData["LoginProvider"] account.
8 |
9 |
32 |
33 | @section Scripts {
34 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Login Failure";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ForgotPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Forgot your password?";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 | For more information on how to enable reset password please see this article.
9 |
10 |
11 | @**@
28 |
29 | @section Scripts {
30 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
31 | }
32 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Forgot Password Confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Please check your email to reset your password.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Locked out";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model RegisterViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ResetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Reset password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
40 |
41 | @section Scripts {
42 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
43 | }
44 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Reset password confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Your password has been reset. Please Click here to log in.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model SendCodeViewModel
2 | @{
3 | ViewData["Title"] = "Send Verification Code";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
18 |
19 | @section Scripts {
20 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyCodeViewModel
2 | @{
3 | ViewData["Title"] = "Verify";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
18 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model AddPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Add Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
24 |
25 | @section Scripts {
26 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ChangePasswordViewModel
2 | @{
3 | ViewData["Title"] = "Change Password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model SetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Set Password";
4 | }
5 |
6 |
7 | You do not have a local username/password for this site. Add a local
8 | account so you can log in without an external login.
9 |
10 |
11 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Verify Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
27 |
28 | @section Scripts {
29 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
30 | }
31 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Error";
3 | }
4 |
5 | Error.
6 | An error occurred while processing your request.
7 |
8 | Development Mode
9 |
10 | Swapping to Development environment will display more detailed information about the error that occurred.
11 |
12 |
13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @using FunWithSqlServer.Models
3 |
4 | @inject SignInManager SignInManager
5 | @inject UserManager UserManager
6 |
7 | @if (SignInManager.IsSignedIn(User))
8 | {
9 |
19 | }
20 | else
21 | {
22 |
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using FunWithSqlServer
2 | @using FunWithSqlServer.Models
3 | @using FunWithSqlServer.Models.AccountViewModels
4 | @using FunWithSqlServer.Models.ManageViewModels
5 | @using Microsoft.AspNetCore.Identity
6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
7 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "DefaultConnection": "server=localhost;userid=root;password=P@ssw0rd!;database=FunWithMySql;"
4 | },
5 | "Logging": {
6 | "IncludeScopes": false,
7 | "LogLevel": {
8 | "Default": "Warning"
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "funwithsqlserver",
3 | "private": true,
4 | "dependencies": {
5 | "bootstrap": "3.3.7",
6 | "jquery": "2.2.4",
7 | "jquery-validation": "1.15.0",
8 | "jquery-validation-unobtrusive": "3.2.6"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/fun.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithMySql/fun.sql
--------------------------------------------------------------------------------
/Module4/FunWithMySql/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "1.0.0-rc4-004771"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Set widths on the form inputs since otherwise they're 100% wide */
14 | input,
15 | select,
16 | textarea {
17 | max-width: 280px;
18 | }
19 |
20 | /* Carousel */
21 | .carousel-caption p {
22 | font-size: 20px;
23 | line-height: 1.4;
24 | }
25 |
26 | /* buttons and links extension to use brackets: [ click me ] */
27 | .btn-bracketed::before {
28 | display: inline-block;
29 | content: "[";
30 | padding-right: 0.5em;
31 | }
32 |
33 | .btn-bracketed::after {
34 | display: inline-block;
35 | content: "]";
36 | padding-left: 0.5em;
37 | }
38 |
39 | /* Make .svg files in the carousel display properly in older browsers */
40 | .carousel-inner .item img[src$=".svg"] {
41 | width: 100%;
42 | }
43 |
44 | /* Hide/rearrange for smaller screens */
45 | @media screen and (max-width: 767px) {
46 | /* Hide captions */
47 | .carousel-caption {
48 | display: none;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.btn-bracketed::before{display:inline-block;content:"[";padding-right:.5em}.btn-bracketed::after{display:inline-block;content:"]";padding-left:.5em}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/Module4/FunWithMySql/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithMySql/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Module4/FunWithMySql/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your Javascript code.
2 |
--------------------------------------------------------------------------------
/Module4/FunWithMySql/wwwroot/js/site.min.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithMySql/wwwroot/js/site.min.js
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": ".NET Core Launch (web)",
6 | "type": "coreclr",
7 | "request": "launch",
8 | "preLaunchTask": "build",
9 | "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\FunWithPostgres.dll",
10 | "args": [],
11 | "cwd": "${workspaceRoot}",
12 | "stopAtEntry": false,
13 | "internalConsoleOptions": "openOnSessionStart",
14 | "launchBrowser": {
15 | "enabled": true,
16 | "args": "${auto-detect-url}",
17 | "windows": {
18 | "command": "cmd.exe",
19 | "args": "/C start ${auto-detect-url}"
20 | },
21 | "osx": {
22 | "command": "open"
23 | },
24 | "linux": {
25 | "command": "xdg-open"
26 | }
27 | },
28 | "env": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | },
31 | "sourceFileMap": {
32 | "/Views": "${workspaceRoot}/Views"
33 | }
34 | },
35 | {
36 | "name": ".NET Core Attach",
37 | "type": "coreclr",
38 | "request": "attach",
39 | "processId": "${command.pickProcess}"
40 | }
41 | ]
42 | }
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "command": "dotnet",
4 | "isShellCommand": true,
5 | "args": [],
6 | "tasks": [
7 | {
8 | "taskName": "build",
9 | "args": [
10 | "${workspaceRoot}\\FunWithPostgres.csproj"
11 | ],
12 | "isBuildCommand": true,
13 | "problemMatcher": "$msCompile"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/.vscode/temp.sql:
--------------------------------------------------------------------------------
1 | SELECT * FROM "AspNetUsers"
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace FunWithPostgres.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore;
7 | using FunWithPostgres.Models;
8 |
9 | namespace FunWithPostgres.Data
10 | {
11 | public class ApplicationDbContext : IdentityDbContext
12 | {
13 | public ApplicationDbContext(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | protected override void OnModelCreating(ModelBuilder builder)
19 | {
20 | base.OnModelCreating(builder);
21 | // Customize the ASP.NET Identity model and override the defaults if needed.
22 | // For example, you can rename the ASP.NET Identity table names and more.
23 | // Add your customizations after calling base.OnModelCreating(builder);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/FunWithPostgres.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp1.0
4 | aspnet-FunWithPostgres-53bc9b9d-9d6a-45d4-8429-2a2761773502
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class ExternalLoginConfirmationViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/ForgotPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class ForgotPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/LoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class LoginViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [DataType(DataType.Password)]
17 | public string Password { get; set; }
18 |
19 | [Display(Name = "Remember me?")]
20 | public bool RememberMe { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/RegisterViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class RegisterViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | [Display(Name = "Email")]
14 | public string Email { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "Password")]
20 | public string Password { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm password")]
24 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/ResetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class ResetPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
17 | [DataType(DataType.Password)]
18 | public string Password { get; set; }
19 |
20 | [DataType(DataType.Password)]
21 | [Display(Name = "Confirm password")]
22 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
23 | public string ConfirmPassword { get; set; }
24 |
25 | public string Code { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/SendCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class SendCodeViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 |
15 | public string ReturnUrl { get; set; }
16 |
17 | public bool RememberMe { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/AccountViewModels/VerifyCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.AccountViewModels
8 | {
9 | public class VerifyCodeViewModel
10 | {
11 | [Required]
12 | public string Provider { get; set; }
13 |
14 | [Required]
15 | public string Code { get; set; }
16 |
17 | public string ReturnUrl { get; set; }
18 |
19 | [Display(Name = "Remember this browser?")]
20 | public bool RememberBrowser { get; set; }
21 |
22 | [Display(Name = "Remember me?")]
23 | public bool RememberMe { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ApplicationUser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 |
7 | namespace FunWithPostgres.Models
8 | {
9 | // Add profile data for application users by adding properties to the ApplicationUser class
10 | public class ApplicationUser : IdentityUser
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/AddPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class AddPhoneNumberViewModel
10 | {
11 | [Required]
12 | [Phone]
13 | [Display(Name = "Phone number")]
14 | public string PhoneNumber { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/ChangePasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class ChangePasswordViewModel
10 | {
11 | [Required]
12 | [DataType(DataType.Password)]
13 | [Display(Name = "Current password")]
14 | public string OldPassword { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "New password")]
20 | public string NewPassword { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm new password")]
24 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class ConfigureTwoFactorViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/FactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithPostgres.Models.ManageViewModels
7 | {
8 | public class FactorViewModel
9 | {
10 | public string Purpose { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/IndexViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class IndexViewModel
10 | {
11 | public bool HasPassword { get; set; }
12 |
13 | public IList Logins { get; set; }
14 |
15 | public string PhoneNumber { get; set; }
16 |
17 | public bool TwoFactor { get; set; }
18 |
19 | public bool BrowserRemembered { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/ManageLoginsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Http.Authentication;
6 | using Microsoft.AspNetCore.Identity;
7 |
8 | namespace FunWithPostgres.Models.ManageViewModels
9 | {
10 | public class ManageLoginsViewModel
11 | {
12 | public IList CurrentLogins { get; set; }
13 |
14 | public IList OtherLogins { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/RemoveLoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class RemoveLoginViewModel
10 | {
11 | public string LoginProvider { get; set; }
12 | public string ProviderKey { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/SetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class SetPasswordViewModel
10 | {
11 | [Required]
12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
13 | [DataType(DataType.Password)]
14 | [Display(Name = "New password")]
15 | public string NewPassword { get; set; }
16 |
17 | [DataType(DataType.Password)]
18 | [Display(Name = "Confirm new password")]
19 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
20 | public string ConfirmPassword { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithPostgres.Models.ManageViewModels
8 | {
9 | public class VerifyPhoneNumberViewModel
10 | {
11 | [Required]
12 | public string Code { get; set; }
13 |
14 | [Required]
15 | [Phone]
16 | [Display(Name = "Phone number")]
17 | public string PhoneNumber { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 |
8 | namespace FunWithPostgres
9 | {
10 | public class Program
11 | {
12 | public static void Main(string[] args)
13 | {
14 | var host = new WebHostBuilder()
15 | .UseKestrel()
16 | .UseContentRoot(Directory.GetCurrentDirectory())
17 | .UseIISIntegration()
18 | .UseStartup()
19 | .Build();
20 |
21 | host.Run();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:1048/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "FunWithPostgres": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "launchUrl": "http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Services/IEmailSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithPostgres.Services
7 | {
8 | public interface IEmailSender
9 | {
10 | Task SendEmailAsync(string email, string subject, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Services/ISmsSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithPostgres.Services
7 | {
8 | public interface ISmsSender
9 | {
10 | Task SendSmsAsync(string number, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Services/MessageServices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithPostgres.Services
7 | {
8 | // This class is used by the application to send Email and SMS
9 | // when you turn on two-factor authentication in ASP.NET Identity.
10 | // For more details see this link https://go.microsoft.com/fwlink/?LinkID=532713
11 | public class AuthMessageSender : IEmailSender, ISmsSender
12 | {
13 | public Task SendEmailAsync(string email, string subject, string message)
14 | {
15 | // Plug in your email service here to send an email.
16 | return Task.FromResult(0);
17 | }
18 |
19 | public Task SendSmsAsync(string number, string message)
20 | {
21 | // Plug in your SMS service here to send a text message.
22 | return Task.FromResult(0);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Confirm Email";
3 | }
4 |
5 | @ViewData["Title"].
6 |
11 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model ExternalLoginConfirmationViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 | Associate your @ViewData["LoginProvider"] account.
8 |
9 |
32 |
33 | @section Scripts {
34 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Login Failure";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ForgotPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Forgot your password?";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 | For more information on how to enable reset password please see this article.
9 |
10 |
11 | @**@
28 |
29 | @section Scripts {
30 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
31 | }
32 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Forgot Password Confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Please check your email to reset your password.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Locked out";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model RegisterViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ResetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Reset password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
40 |
41 | @section Scripts {
42 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
43 | }
44 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Reset password confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Your password has been reset. Please Click here to log in.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model SendCodeViewModel
2 | @{
3 | ViewData["Title"] = "Send Verification Code";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
18 |
19 | @section Scripts {
20 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyCodeViewModel
2 | @{
3 | ViewData["Title"] = "Verify";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
18 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model AddPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Add Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
24 |
25 | @section Scripts {
26 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ChangePasswordViewModel
2 | @{
3 | ViewData["Title"] = "Change Password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model SetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Set Password";
4 | }
5 |
6 |
7 | You do not have a local username/password for this site. Add a local
8 | account so you can log in without an external login.
9 |
10 |
11 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Verify Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
27 |
28 | @section Scripts {
29 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
30 | }
31 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Error";
3 | }
4 |
5 | Error.
6 | An error occurred while processing your request.
7 |
8 | Development Mode
9 |
10 | Swapping to Development environment will display more detailed information about the error that occurred.
11 |
12 |
13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @using FunWithPostgres.Models
3 |
4 | @inject SignInManager SignInManager
5 | @inject UserManager UserManager
6 |
7 | @if (SignInManager.IsSignedIn(User))
8 | {
9 |
19 | }
20 | else
21 | {
22 |
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using FunWithPostgres
2 | @using FunWithPostgres.Models
3 | @using FunWithPostgres.Models.AccountViewModels
4 | @using FunWithPostgres.Models.ManageViewModels
5 | @using Microsoft.AspNetCore.Identity
6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
7 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "DefaultConnection": "User ID=postgres;Password=P@ssw0rd!;Host=localhost;Port=5432;Database=FunWithPostgres;Pooling=true;"
4 | },
5 | "Logging": {
6 | "IncludeScopes": false,
7 | "LogLevel": {
8 | "Default": "Warning"
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "funwithpostgres",
3 | "private": true,
4 | "dependencies": {
5 | "bootstrap": "3.3.7",
6 | "jquery": "2.2.4",
7 | "jquery-validation": "1.15.0",
8 | "jquery-validation-unobtrusive": "3.2.6"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "1.0.0-rc4-004771"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Set widths on the form inputs since otherwise they're 100% wide */
14 | input,
15 | select,
16 | textarea {
17 | max-width: 280px;
18 | }
19 |
20 | /* Carousel */
21 | .carousel-caption p {
22 | font-size: 20px;
23 | line-height: 1.4;
24 | }
25 |
26 | /* buttons and links extension to use brackets: [ click me ] */
27 | .btn-bracketed::before {
28 | display: inline-block;
29 | content: "[";
30 | padding-right: 0.5em;
31 | }
32 |
33 | .btn-bracketed::after {
34 | display: inline-block;
35 | content: "]";
36 | padding-left: 0.5em;
37 | }
38 |
39 | /* Make .svg files in the carousel display properly in older browsers */
40 | .carousel-inner .item img[src$=".svg"] {
41 | width: 100%;
42 | }
43 |
44 | /* Hide/rearrange for smaller screens */
45 | @media screen and (max-width: 767px) {
46 | /* Hide captions */
47 | .carousel-caption {
48 | display: none;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.btn-bracketed::before{display:inline-block;content:"[";padding-right:.5em}.btn-bracketed::after{display:inline-block;content:"]";padding-left:.5em}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithPostgres/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your Javascript code.
2 |
--------------------------------------------------------------------------------
/Module4/FunWithPostgres/wwwroot/js/site.min.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithPostgres/wwwroot/js/site.min.js
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": ".NET Core Launch (web)",
6 | "type": "coreclr",
7 | "request": "launch",
8 | "preLaunchTask": "build",
9 | "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\FunWithSqlServer.dll",
10 | "args": [],
11 | "cwd": "${workspaceRoot}",
12 | "stopAtEntry": false,
13 | "internalConsoleOptions": "openOnSessionStart",
14 | "launchBrowser": {
15 | "enabled": true,
16 | "args": "${auto-detect-url}",
17 | "windows": {
18 | "command": "cmd.exe",
19 | "args": "/C start ${auto-detect-url}"
20 | },
21 | "osx": {
22 | "command": "open"
23 | },
24 | "linux": {
25 | "command": "xdg-open"
26 | }
27 | },
28 | "env": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | },
31 | "sourceFileMap": {
32 | "/Views": "${workspaceRoot}/Views"
33 | }
34 | },
35 | {
36 | "name": ".NET Core Attach",
37 | "type": "coreclr",
38 | "request": "attach",
39 | "processId": "${command.pickProcess}"
40 | }
41 | ]
42 | }
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | }
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "command": "dotnet",
4 | "isShellCommand": true,
5 | "args": [],
6 | "tasks": [
7 | {
8 | "taskName": "build",
9 | "args": [
10 | "${workspaceRoot}\\FunWithSqlServer.csproj"
11 | ],
12 | "isBuildCommand": true,
13 | "problemMatcher": "$msCompile"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace FunWithSqlServer.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore;
7 | using FunWithSqlServer.Models;
8 |
9 | namespace FunWithSqlServer.Data
10 | {
11 | public class ApplicationDbContext : IdentityDbContext
12 | {
13 | public ApplicationDbContext(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | protected override void OnModelCreating(ModelBuilder builder)
19 | {
20 | base.OnModelCreating(builder);
21 | // Customize the ASP.NET Identity model and override the defaults if needed.
22 | // For example, you can rename the ASP.NET Identity table names and more.
23 | // Add your customizations after calling base.OnModelCreating(builder);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class ExternalLoginConfirmationViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/ForgotPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class ForgotPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/LoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class LoginViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [DataType(DataType.Password)]
17 | public string Password { get; set; }
18 |
19 | [Display(Name = "Remember me?")]
20 | public bool RememberMe { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/RegisterViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class RegisterViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | [Display(Name = "Email")]
14 | public string Email { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "Password")]
20 | public string Password { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm password")]
24 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/ResetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class ResetPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
17 | [DataType(DataType.Password)]
18 | public string Password { get; set; }
19 |
20 | [DataType(DataType.Password)]
21 | [Display(Name = "Confirm password")]
22 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
23 | public string ConfirmPassword { get; set; }
24 |
25 | public string Code { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/SendCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class SendCodeViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 |
15 | public string ReturnUrl { get; set; }
16 |
17 | public bool RememberMe { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/AccountViewModels/VerifyCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.AccountViewModels
8 | {
9 | public class VerifyCodeViewModel
10 | {
11 | [Required]
12 | public string Provider { get; set; }
13 |
14 | [Required]
15 | public string Code { get; set; }
16 |
17 | public string ReturnUrl { get; set; }
18 |
19 | [Display(Name = "Remember this browser?")]
20 | public bool RememberBrowser { get; set; }
21 |
22 | [Display(Name = "Remember me?")]
23 | public bool RememberMe { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ApplicationUser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 |
7 | namespace FunWithSqlServer.Models
8 | {
9 | // Add profile data for application users by adding properties to the ApplicationUser class
10 | public class ApplicationUser : IdentityUser
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/AddPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class AddPhoneNumberViewModel
10 | {
11 | [Required]
12 | [Phone]
13 | [Display(Name = "Phone number")]
14 | public string PhoneNumber { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/ChangePasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class ChangePasswordViewModel
10 | {
11 | [Required]
12 | [DataType(DataType.Password)]
13 | [Display(Name = "Current password")]
14 | public string OldPassword { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "New password")]
20 | public string NewPassword { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm new password")]
24 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class ConfigureTwoFactorViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/FactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Models.ManageViewModels
7 | {
8 | public class FactorViewModel
9 | {
10 | public string Purpose { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/IndexViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class IndexViewModel
10 | {
11 | public bool HasPassword { get; set; }
12 |
13 | public IList Logins { get; set; }
14 |
15 | public string PhoneNumber { get; set; }
16 |
17 | public bool TwoFactor { get; set; }
18 |
19 | public bool BrowserRemembered { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/ManageLoginsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Http.Authentication;
6 | using Microsoft.AspNetCore.Identity;
7 |
8 | namespace FunWithSqlServer.Models.ManageViewModels
9 | {
10 | public class ManageLoginsViewModel
11 | {
12 | public IList CurrentLogins { get; set; }
13 |
14 | public IList OtherLogins { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/RemoveLoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class RemoveLoginViewModel
10 | {
11 | public string LoginProvider { get; set; }
12 | public string ProviderKey { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/SetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class SetPasswordViewModel
10 | {
11 | [Required]
12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
13 | [DataType(DataType.Password)]
14 | [Display(Name = "New password")]
15 | public string NewPassword { get; set; }
16 |
17 | [DataType(DataType.Password)]
18 | [Display(Name = "Confirm new password")]
19 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
20 | public string ConfirmPassword { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlServer.Models.ManageViewModels
8 | {
9 | public class VerifyPhoneNumberViewModel
10 | {
11 | [Required]
12 | public string Code { get; set; }
13 |
14 | [Required]
15 | [Phone]
16 | [Display(Name = "Phone number")]
17 | public string PhoneNumber { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 |
8 | namespace FunWithSqlServer
9 | {
10 | public class Program
11 | {
12 | public static void Main(string[] args)
13 | {
14 | var host = new WebHostBuilder()
15 | .UseKestrel()
16 | .UseContentRoot(Directory.GetCurrentDirectory())
17 | .UseIISIntegration()
18 | .UseStartup()
19 | .Build();
20 |
21 | host.Run();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:1048/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "FunWithSqlServer": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "launchUrl": "http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Services/IEmailSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Services
7 | {
8 | public interface IEmailSender
9 | {
10 | Task SendEmailAsync(string email, string subject, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Services/ISmsSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Services
7 | {
8 | public interface ISmsSender
9 | {
10 | Task SendSmsAsync(string number, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Services/MessageServices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlServer.Services
7 | {
8 | // This class is used by the application to send Email and SMS
9 | // when you turn on two-factor authentication in ASP.NET Identity.
10 | // For more details see this link https://go.microsoft.com/fwlink/?LinkID=532713
11 | public class AuthMessageSender : IEmailSender, ISmsSender
12 | {
13 | public Task SendEmailAsync(string email, string subject, string message)
14 | {
15 | // Plug in your email service here to send an email.
16 | return Task.FromResult(0);
17 | }
18 |
19 | public Task SendSmsAsync(string number, string message)
20 | {
21 | // Plug in your SMS service here to send a text message.
22 | return Task.FromResult(0);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Confirm Email";
3 | }
4 |
5 | @ViewData["Title"].
6 |
11 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model ExternalLoginConfirmationViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 | Associate your @ViewData["LoginProvider"] account.
8 |
9 |
32 |
33 | @section Scripts {
34 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Login Failure";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ForgotPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Forgot your password?";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 | For more information on how to enable reset password please see this article.
9 |
10 |
11 | @**@
28 |
29 | @section Scripts {
30 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
31 | }
32 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Forgot Password Confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Please check your email to reset your password.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Locked out";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model RegisterViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ResetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Reset password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
40 |
41 | @section Scripts {
42 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
43 | }
44 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Reset password confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Your password has been reset. Please Click here to log in.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model SendCodeViewModel
2 | @{
3 | ViewData["Title"] = "Send Verification Code";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
18 |
19 | @section Scripts {
20 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyCodeViewModel
2 | @{
3 | ViewData["Title"] = "Verify";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
18 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model AddPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Add Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
24 |
25 | @section Scripts {
26 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ChangePasswordViewModel
2 | @{
3 | ViewData["Title"] = "Change Password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model SetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Set Password";
4 | }
5 |
6 |
7 | You do not have a local username/password for this site. Add a local
8 | account so you can log in without an external login.
9 |
10 |
11 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Verify Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
27 |
28 | @section Scripts {
29 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
30 | }
31 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Error";
3 | }
4 |
5 | Error.
6 | An error occurred while processing your request.
7 |
8 | Development Mode
9 |
10 | Swapping to Development environment will display more detailed information about the error that occurred.
11 |
12 |
13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @using FunWithSqlServer.Models
3 |
4 | @inject SignInManager SignInManager
5 | @inject UserManager UserManager
6 |
7 | @if (SignInManager.IsSignedIn(User))
8 | {
9 |
19 | }
20 | else
21 | {
22 |
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using FunWithSqlServer
2 | @using FunWithSqlServer.Models
3 | @using FunWithSqlServer.Models.AccountViewModels
4 | @using FunWithSqlServer.Models.ManageViewModels
5 | @using Microsoft.AspNetCore.Identity
6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
7 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=FunWithSqlServer;Trusted_Connection=true;MultipleActiveResultsets=true"
4 | },
5 | "Logging": {
6 | "IncludeScopes": false,
7 | "LogLevel": {
8 | "Default": "Warning"
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "funwithsqlserver",
3 | "private": true,
4 | "dependencies": {
5 | "bootstrap": "3.3.7",
6 | "jquery": "2.2.4",
7 | "jquery-validation": "1.15.0",
8 | "jquery-validation-unobtrusive": "3.2.6"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "1.0.0-rc4-004771"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/test.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithSqlServer/test.sql
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Set widths on the form inputs since otherwise they're 100% wide */
14 | input,
15 | select,
16 | textarea {
17 | max-width: 280px;
18 | }
19 |
20 | /* Carousel */
21 | .carousel-caption p {
22 | font-size: 20px;
23 | line-height: 1.4;
24 | }
25 |
26 | /* buttons and links extension to use brackets: [ click me ] */
27 | .btn-bracketed::before {
28 | display: inline-block;
29 | content: "[";
30 | padding-right: 0.5em;
31 | }
32 |
33 | .btn-bracketed::after {
34 | display: inline-block;
35 | content: "]";
36 | padding-left: 0.5em;
37 | }
38 |
39 | /* Make .svg files in the carousel display properly in older browsers */
40 | .carousel-inner .item img[src$=".svg"] {
41 | width: 100%;
42 | }
43 |
44 | /* Hide/rearrange for smaller screens */
45 | @media screen and (max-width: 767px) {
46 | /* Hide captions */
47 | .carousel-caption {
48 | display: none;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.btn-bracketed::before{display:inline-block;content:"[";padding-right:.5em}.btn-bracketed::after{display:inline-block;content:"]";padding-left:.5em}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithSqlServer/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your Javascript code.
2 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlServer/wwwroot/js/site.min.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithSqlServer/wwwroot/js/site.min.js
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": ".NET Core Launch (web)",
6 | "type": "coreclr",
7 | "request": "launch",
8 | "preLaunchTask": "build",
9 | "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\FunWithSqlite.dll",
10 | "args": [],
11 | "cwd": "${workspaceRoot}",
12 | "stopAtEntry": false,
13 | "internalConsoleOptions": "openOnSessionStart",
14 | "launchBrowser": {
15 | "enabled": true,
16 | "args": "${auto-detect-url}",
17 | "windows": {
18 | "command": "cmd.exe",
19 | "args": "/C start ${auto-detect-url}"
20 | },
21 | "osx": {
22 | "command": "open"
23 | },
24 | "linux": {
25 | "command": "xdg-open"
26 | }
27 | },
28 | "env": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | },
31 | "sourceFileMap": {
32 | "/Views": "${workspaceRoot}/Views"
33 | }
34 | },
35 | {
36 | "name": ".NET Core Attach",
37 | "type": "coreclr",
38 | "request": "attach",
39 | "processId": "${command.pickProcess}"
40 | }
41 | ]
42 | }
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "command": "dotnet",
4 | "isShellCommand": true,
5 | "args": [],
6 | "tasks": [
7 | {
8 | "taskName": "build",
9 | "args": [
10 | "${workspaceRoot}\\FunWithSqlite.csproj"
11 | ],
12 | "isBuildCommand": true,
13 | "problemMatcher": "$msCompile"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace FunWithSqlite.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Data/ApplicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 | using Microsoft.EntityFrameworkCore;
7 | using FunWithSqlite.Models;
8 |
9 | namespace FunWithSqlite.Data
10 | {
11 | public class ApplicationDbContext : IdentityDbContext
12 | {
13 | public ApplicationDbContext(DbContextOptions options)
14 | : base(options)
15 | {
16 | }
17 |
18 | protected override void OnModelCreating(ModelBuilder builder)
19 | {
20 | base.OnModelCreating(builder);
21 | // Customize the ASP.NET Identity model and override the defaults if needed.
22 | // For example, you can rename the ASP.NET Identity table names and more.
23 | // Add your customizations after calling base.OnModelCreating(builder);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/FunWithSqlite.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithSqlite/FunWithSqlite.db
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class ExternalLoginConfirmationViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/ForgotPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class ForgotPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/LoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class LoginViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [DataType(DataType.Password)]
17 | public string Password { get; set; }
18 |
19 | [Display(Name = "Remember me?")]
20 | public bool RememberMe { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/RegisterViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class RegisterViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | [Display(Name = "Email")]
14 | public string Email { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "Password")]
20 | public string Password { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm password")]
24 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/ResetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class ResetPasswordViewModel
10 | {
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Required]
16 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
17 | [DataType(DataType.Password)]
18 | public string Password { get; set; }
19 |
20 | [DataType(DataType.Password)]
21 | [Display(Name = "Confirm password")]
22 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
23 | public string ConfirmPassword { get; set; }
24 |
25 | public string Code { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/SendCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class SendCodeViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 |
15 | public string ReturnUrl { get; set; }
16 |
17 | public bool RememberMe { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/AccountViewModels/VerifyCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.AccountViewModels
8 | {
9 | public class VerifyCodeViewModel
10 | {
11 | [Required]
12 | public string Provider { get; set; }
13 |
14 | [Required]
15 | public string Code { get; set; }
16 |
17 | public string ReturnUrl { get; set; }
18 |
19 | [Display(Name = "Remember this browser?")]
20 | public bool RememberBrowser { get; set; }
21 |
22 | [Display(Name = "Remember me?")]
23 | public bool RememberMe { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ApplicationUser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6 |
7 | namespace FunWithSqlite.Models
8 | {
9 | // Add profile data for application users by adding properties to the ApplicationUser class
10 | public class ApplicationUser : IdentityUser
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/AddPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class AddPhoneNumberViewModel
10 | {
11 | [Required]
12 | [Phone]
13 | [Display(Name = "Phone number")]
14 | public string PhoneNumber { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/ChangePasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class ChangePasswordViewModel
10 | {
11 | [Required]
12 | [DataType(DataType.Password)]
13 | [Display(Name = "Current password")]
14 | public string OldPassword { get; set; }
15 |
16 | [Required]
17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
18 | [DataType(DataType.Password)]
19 | [Display(Name = "New password")]
20 | public string NewPassword { get; set; }
21 |
22 | [DataType(DataType.Password)]
23 | [Display(Name = "Confirm new password")]
24 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
25 | public string ConfirmPassword { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class ConfigureTwoFactorViewModel
10 | {
11 | public string SelectedProvider { get; set; }
12 |
13 | public ICollection Providers { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/FactorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlite.Models.ManageViewModels
7 | {
8 | public class FactorViewModel
9 | {
10 | public string Purpose { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/IndexViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class IndexViewModel
10 | {
11 | public bool HasPassword { get; set; }
12 |
13 | public IList Logins { get; set; }
14 |
15 | public string PhoneNumber { get; set; }
16 |
17 | public bool TwoFactor { get; set; }
18 |
19 | public bool BrowserRemembered { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/ManageLoginsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Http.Authentication;
6 | using Microsoft.AspNetCore.Identity;
7 |
8 | namespace FunWithSqlite.Models.ManageViewModels
9 | {
10 | public class ManageLoginsViewModel
11 | {
12 | public IList CurrentLogins { get; set; }
13 |
14 | public IList OtherLogins { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/RemoveLoginViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class RemoveLoginViewModel
10 | {
11 | public string LoginProvider { get; set; }
12 | public string ProviderKey { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/SetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class SetPasswordViewModel
10 | {
11 | [Required]
12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
13 | [DataType(DataType.Password)]
14 | [Display(Name = "New password")]
15 | public string NewPassword { get; set; }
16 |
17 | [DataType(DataType.Password)]
18 | [Display(Name = "Confirm new password")]
19 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
20 | public string ConfirmPassword { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace FunWithSqlite.Models.ManageViewModels
8 | {
9 | public class VerifyPhoneNumberViewModel
10 | {
11 | [Required]
12 | public string Code { get; set; }
13 |
14 | [Required]
15 | [Phone]
16 | [Display(Name = "Phone number")]
17 | public string PhoneNumber { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 |
8 | namespace FunWithSqlite
9 | {
10 | public class Program
11 | {
12 | public static void Main(string[] args)
13 | {
14 | var host = new WebHostBuilder()
15 | .UseKestrel()
16 | .UseContentRoot(Directory.GetCurrentDirectory())
17 | .UseIISIntegration()
18 | .UseStartup()
19 | .Build();
20 |
21 | host.Run();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:1048/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "FunWithSqlite": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "launchUrl": "http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Services/IEmailSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlite.Services
7 | {
8 | public interface IEmailSender
9 | {
10 | Task SendEmailAsync(string email, string subject, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Services/ISmsSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlite.Services
7 | {
8 | public interface ISmsSender
9 | {
10 | Task SendSmsAsync(string number, string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Services/MessageServices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace FunWithSqlite.Services
7 | {
8 | // This class is used by the application to send Email and SMS
9 | // when you turn on two-factor authentication in ASP.NET Identity.
10 | // For more details see this link https://go.microsoft.com/fwlink/?LinkID=532713
11 | public class AuthMessageSender : IEmailSender, ISmsSender
12 | {
13 | public Task SendEmailAsync(string email, string subject, string message)
14 | {
15 | // Plug in your email service here to send an email.
16 | return Task.FromResult(0);
17 | }
18 |
19 | public Task SendSmsAsync(string number, string message)
20 | {
21 | // Plug in your SMS service here to send a text message.
22 | return Task.FromResult(0);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Confirm Email";
3 | }
4 |
5 | @ViewData["Title"].
6 |
11 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model ExternalLoginConfirmationViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 | Associate your @ViewData["LoginProvider"] account.
8 |
9 |
32 |
33 | @section Scripts {
34 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
35 | }
36 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Login Failure";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ForgotPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Forgot your password?";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 | For more information on how to enable reset password please see this article.
9 |
10 |
11 | @**@
28 |
29 | @section Scripts {
30 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
31 | }
32 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Forgot Password Confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Please check your email to reset your password.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Locked out";
3 | }
4 |
5 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model RegisterViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ResetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Reset password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
40 |
41 | @section Scripts {
42 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
43 | }
44 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Reset password confirmation";
3 | }
4 |
5 | @ViewData["Title"].
6 |
7 | Your password has been reset. Please Click here to log in.
8 |
9 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model SendCodeViewModel
2 | @{
3 | ViewData["Title"] = "Send Verification Code";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
18 |
19 | @section Scripts {
20 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
21 | }
22 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyCodeViewModel
2 | @{
3 | ViewData["Title"] = "Verify";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
18 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model AddPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Add Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
24 |
25 | @section Scripts {
26 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
27 | }
28 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ChangePasswordViewModel
2 | @{
3 | ViewData["Title"] = "Change Password";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
39 |
40 | @section Scripts {
41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
42 | }
43 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model SetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Set Password";
4 | }
5 |
6 |
7 | You do not have a local username/password for this site. Add a local
8 | account so you can log in without an external login.
9 |
10 |
11 |
35 |
36 | @section Scripts {
37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
38 | }
39 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model VerifyPhoneNumberViewModel
2 | @{
3 | ViewData["Title"] = "Verify Phone Number";
4 | }
5 |
6 | @ViewData["Title"].
7 |
8 |
27 |
28 | @section Scripts {
29 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
30 | }
31 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Error";
3 | }
4 |
5 | Error.
6 | An error occurred while processing your request.
7 |
8 | Development Mode
9 |
10 | Swapping to Development environment will display more detailed information about the error that occurred.
11 |
12 |
13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @using FunWithSqlite.Models
3 |
4 | @inject SignInManager SignInManager
5 | @inject UserManager UserManager
6 |
7 | @if (SignInManager.IsSignedIn(User))
8 | {
9 |
19 | }
20 | else
21 | {
22 |
26 | }
27 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using FunWithSqlite
2 | @using FunWithSqlite.Models
3 | @using FunWithSqlite.Models.AccountViewModels
4 | @using FunWithSqlite.Models.ManageViewModels
5 | @using Microsoft.AspNetCore.Identity
6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
7 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "DefaultConnection": "DataSource=.\\FunWithSqlite.db"
4 | },
5 | "Logging": {
6 | "IncludeScopes": false,
7 | "LogLevel": {
8 | "Default": "Warning"
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "funwithsqlite",
3 | "private": true,
4 | "dependencies": {
5 | "bootstrap": "3.3.7",
6 | "jquery": "2.2.4",
7 | "jquery-validation": "1.15.0",
8 | "jquery-validation-unobtrusive": "3.2.6"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "1.0.0-rc4-004771"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Set widths on the form inputs since otherwise they're 100% wide */
14 | input,
15 | select,
16 | textarea {
17 | max-width: 280px;
18 | }
19 |
20 | /* Carousel */
21 | .carousel-caption p {
22 | font-size: 20px;
23 | line-height: 1.4;
24 | }
25 |
26 | /* buttons and links extension to use brackets: [ click me ] */
27 | .btn-bracketed::before {
28 | display: inline-block;
29 | content: "[";
30 | padding-right: 0.5em;
31 | }
32 |
33 | .btn-bracketed::after {
34 | display: inline-block;
35 | content: "]";
36 | padding-left: 0.5em;
37 | }
38 |
39 | /* Make .svg files in the carousel display properly in older browsers */
40 | .carousel-inner .item img[src$=".svg"] {
41 | width: 100%;
42 | }
43 |
44 | /* Hide/rearrange for smaller screens */
45 | @media screen and (max-width: 767px) {
46 | /* Hide captions */
47 | .carousel-caption {
48 | display: none;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.btn-bracketed::before{display:inline-block;content:"[";padding-right:.5em}.btn-bracketed::after{display:inline-block;content:"]";padding-left:.5em}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithSqlite/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your Javascript code.
2 |
--------------------------------------------------------------------------------
/Module4/FunWithSqlite/wwwroot/js/site.min.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module4/FunWithSqlite/wwwroot/js/site.min.js
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "commonjs": true,
5 | "es6": true,
6 | "node": true
7 | },
8 | "parserOptions": {
9 | "ecmaFeatures": {
10 | "jsx": true
11 | },
12 | "sourceType": "module"
13 | },
14 | "rules": {
15 | "no-const-assign": "warn",
16 | "no-this-before-super": "warn",
17 | "no-undef": "warn",
18 | "no-unreachable": "warn",
19 | "no-unused-vars": "warn",
20 | "constructor-super": "warn",
21 | "valid-typeof": "warn"
22 | }
23 | }
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": ".NET Core Launch (web)",
6 | "type": "coreclr",
7 | "request": "launch",
8 | "preLaunchTask": "build",
9 | "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\CustomizingVSCode.dll",
10 | "args": [],
11 | "cwd": "${workspaceRoot}",
12 | "stopAtEntry": false,
13 | "internalConsoleOptions": "openOnSessionStart",
14 | "launchBrowser": {
15 | "enabled": true,
16 | "args": "${auto-detect-url}",
17 | "windows": {
18 | "command": "cmd.exe",
19 | "args": "/C start ${auto-detect-url}"
20 | },
21 | "osx": {
22 | "command": "open"
23 | },
24 | "linux": {
25 | "command": "xdg-open"
26 | }
27 | },
28 | "env": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | },
31 | "sourceFileMap": {
32 | "/Views": "${workspaceRoot}/Views"
33 | }
34 | },
35 | {
36 | "name": ".NET Core Attach",
37 | "type": "coreclr",
38 | "request": "attach",
39 | "processId": "${command.pickProcess}"
40 | }
41 | ]
42 | }
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "eslint.enable": true
3 | }
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "command": "dotnet",
4 | "isShellCommand": true,
5 | "args": [],
6 | "tasks": [
7 | {
8 | "taskName": "build",
9 | "args": [
10 | "${workspaceRoot}\\CustomizingVSCode.csproj"
11 | ],
12 | "isBuildCommand": true,
13 | "problemMatcher": "$msCompile"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace CustomizingVSCode.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View();
33 | }
34 |
35 |
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/CustomizingVSCode.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp1.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Data/foo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 |
8 | namespace CustomizingVSCode
9 | {
10 | public class Program
11 | {
12 | public static void Main(string[] args)
13 | {
14 | var host = new WebHostBuilder()
15 | .UseKestrel()
16 | .UseContentRoot(Directory.GetCurrentDirectory())
17 | .UseIISIntegration()
18 | .UseStartup()
19 | .Build();
20 |
21 | host.Run();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:55462/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "CustomizingVSCode": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "launchUrl": "http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace CustomizingVSCode
12 | {
13 | public class Startup
14 | {
15 | public Startup(IHostingEnvironment env)
16 | {
17 | var builder = new ConfigurationBuilder()
18 | .SetBasePath(env.ContentRootPath)
19 | .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
20 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
21 | .AddEnvironmentVariables();
22 | Configuration = builder.Build();
23 | }
24 |
25 | public IConfigurationRoot Configuration { get; }
26 |
27 | // This method gets called by the runtime. Use this method to add services to the container.
28 | public void ConfigureServices(IServiceCollection services)
29 | {
30 | // Add framework services.
31 | services.AddMvc();
32 | }
33 |
34 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
35 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
36 | {
37 | loggerFactory.AddConsole(Configuration.GetSection("Logging"));
38 | loggerFactory.AddDebug();
39 |
40 | if (env.IsDevelopment())
41 | {
42 | app.UseDeveloperExceptionPage();
43 | }
44 | else
45 | {
46 | app.UseExceptionHandler("/Home/Error");
47 | }
48 |
49 | app.UseStaticFiles();
50 |
51 | app.UseMvc(routes =>
52 | {
53 | routes.MapRoute(
54 | name: "default",
55 | template: "{controller=Home}/{action=Index}/{id?}");
56 | });
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "About";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Contact";
3 | }
4 | @ViewData["Title"].
5 | @ViewData["Message"]
6 |
7 |
8 |
9 | One Microsoft Way
10 | Redmond, WA 98052-6399
11 | P:
12 | 425.555.0100
13 |
14 |
15 |
16 | Support: Support@example.com
17 | Marketing: Marketing@example.com
18 |
19 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Error";
3 | }
4 |
5 | Error.
6 | An error occurred while processing your request.
7 |
8 | Development Mode
9 |
10 | Swapping to Development environment will display more detailed information about the error that occurred.
11 |
12 |
13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
14 |
15 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using CustomizingVSCode
2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
3 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "customizingvscode",
3 | "private": true,
4 | "dependencies": {
5 | "bootstrap": "3.3.7",
6 | "jquery": "2.2.4",
7 | "jquery-validation": "1.15.0",
8 | "jquery-validation-unobtrusive": "3.2.6",
9 | "underscore": "~1.8.3"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "1.0.0-rc4-004771"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/testget.rest:
--------------------------------------------------------------------------------
1 | GET http://api.github.com/users/shawnwildermuth/repos
2 | If-None-Match: W/"25ddf72a2674b68853dcf5642e1eb0cb"
3 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "allowJs": false,
5 | "target": "es5",
6 | "module": "commonjs",
7 | "sourceMap": true,
8 | "listFiles": true
9 | },
10 | "include": [
11 | "wwwroot/js/**/*"
12 | ]
13 | }
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "no-unused-expression": true,
4 | "no-duplicate-variable": true,
5 | "no-duplicate-key": true,
6 | "no-unused-variable": true,
7 | "curly": true,
8 | "class-name": true,
9 | "semicolon": ["always"],
10 | "triple-equals": true
11 | }
12 | }
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Set widths on the form inputs since otherwise they're 100% wide */
14 | input,
15 | select,
16 | textarea {
17 | max-width: 280px;
18 | }
19 |
20 | /* Carousel */
21 | .carousel-caption p {
22 | font-size: 20px;
23 | line-height: 1.4;
24 | }
25 |
26 | /* Make .svg files in the carousel display properly in older browsers */
27 | .carousel-inner .item img[src$=".svg"] {
28 | width: 100%;
29 | }
30 |
31 | /* Hide/rearrange for smaller screens */
32 | @media screen and (max-width: 767px) {
33 | /* Hide captions */
34 | .carousel-caption {
35 | display: none;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
2 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module5/CustomizingVSCode/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/js/person.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var Person = (function () {
3 | function Person() {
4 | }
5 | return Person;
6 | }());
7 | exports.Person = Person;
8 | //# sourceMappingURL=person.js.map
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/js/person.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"person.js","sourceRoot":"","sources":["person.ts"],"names":[],"mappings":";AAAA;IACE;IAEA,CAAC;IAKH,aAAC;AAAD,CAAC,AARD,IAQC;AARY,wBAAM"}
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/js/person.ts:
--------------------------------------------------------------------------------
1 | export class Person {
2 | constructor() {
3 |
4 | }
5 |
6 | name:string;
7 | birthdate:Date;
8 |
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your Javascript code.
2 | function helloWorld() {
3 | let x = 0;
4 | return x;
5 | }
6 |
7 | helloWorld();
--------------------------------------------------------------------------------
/Module5/CustomizingVSCode/wwwroot/js/site.min.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psauthor/VSCodeForCore/a459f694c8b0be394388bcb9087cf197b2408b8f/Module5/CustomizingVSCode/wwwroot/js/site.min.js
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VSCodeForCore
2 |
3 | This is the source code for taking the Visual Studio Code for ASP.NET Core course on Pluralsight
4 |
--------------------------------------------------------------------------------