Skip to content

Commit

Permalink
Add SQL Server project (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
elanderson committed Dec 18, 2018
1 parent 99c891e commit bb5d569
Show file tree
Hide file tree
Showing 110 changed files with 4,965 additions and 253 deletions.
591 changes: 338 additions & 253 deletions .gitignore

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions SqlServer/SqlServer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlServer", "SqlServer\SqlServer.csproj", "{9C99EB70-BB57-4D41-876D-B35234DC4E39}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C99EB70-BB57-4D41-876D-B35234DC4E39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C99EB70-BB57-4D41-876D-B35234DC4E39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C99EB70-BB57-4D41-876D-B35234DC4E39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C99EB70-BB57-4D41-876D-B35234DC4E39}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5BC14972-1FF4-49F1-A51F-3885C2F43261}
EndGlobalSection
EndGlobal
33 changes: 33 additions & 0 deletions SqlServer/SqlServer/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using SqlServer.Data;

namespace SqlServer.Controllers
{
[Route("[controller]/[action]")]
public class AccountController : Controller
{
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger _logger;

public AccountController(SignInManager<ApplicationUser> signInManager, ILogger<AccountController> logger)
{
_signInManager = signInManager;
_logger = logger;
}

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Logout()
{
await _signInManager.SignOutAsync();
_logger.LogInformation("User logged out.");
return RedirectToPage("/Index");
}
}
}
25 changes: 25 additions & 0 deletions SqlServer/SqlServer/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace SqlServer.Data
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}

protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
}
}
}
13 changes: 13 additions & 0 deletions SqlServer/SqlServer/Data/ApplicationUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;

namespace SqlServer.Data
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
}
}
14 changes: 14 additions & 0 deletions SqlServer/SqlServer/Data/Contact.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace SqlServer.Data
{
public class Contact
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Subregion { get; set; }
public string PostalCode { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
}
}
20 changes: 20 additions & 0 deletions SqlServer/SqlServer/Data/ContactsDbContext .cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;

namespace SqlServer.Data
{
public class ContactsDbContext : DbContext
{
public DbSet<Contact> Contacts { get; set; }

public ContactsDbContext(DbContextOptions<ContactsDbContext> options)
: base(options)
{

}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bb5d569

Please sign in to comment.