Skip to content

Instantly share code, notes, and snippets.

Avatar

James Churchill smashdevcode

View GitHub Profile
@smashdevcode
smashdevcode / dotnet-user-auth-s1t1-model-classes.cs
Last active May 30, 2018
User Authentication with ASP.NET Identity - Reviewing the Project Files - Model Classes
View dotnet-user-auth-s1t1-model-classes.cs
/// <summary>
/// Represents a physical activity.
/// </summary>
public class Activity
{
/// <summary>
/// Constructor for creating activities.
/// </summary>
public Activity()
{
@smashdevcode
smashdevcode / tutorial.md
Last active Apr 11, 2018 — forked from kenhowardpdx/tutorial.md
Node Quick Start Tutorial Using TypeScript
View tutorial.md

Initial Setup

Download and install VS Code

Download and install Node

Create a Project Folder & Open VS Code

View treehouse-blog-post-ef-query.cs
public static ComicBook GetComicBook(int comicBookId)
{
using (var context = new Context())
{
return context.ComicBooks
.Where(cb => cb.Id == comicBookId)
.SingleOrDefault();
}
}
View treehouse-blog-post-adonet-query.cs
public static DataTable GetComicBook(int comicBookId)
{
using (var conn = new SqlConnection(ConnectionString))
{
using (var cmd = new SqlCommand($@"
SELECT Id, SeriesId, IssueNumber,
[Description], PublishedOn, AverageRatng
FROM ComicBook
WHERE Id = {comicBookId};
", conn))
View treehouse-ef-with-aspnet-mvc-s3v8.cs
using ComicBookLibraryManagerWebApp.ViewModels;
using ComicBookShared.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Data.Entity;
View treehouse-ef-migrations-s1v7.cs
const int roleIdScript = 1;
const int roleIdPencils = 2;
context.Roles.AddOrUpdate(
r => r.Id,
new Role() { Id = roleIdScript, Name = "Script" },
new Role() { Id = roleIdPencils, Name = "Pencils" }
);