This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int GetResponse() | |
{ | |
int result; | |
do | |
{ | |
Console.Write("Enter an int: "); | |
} while (!int.TryParse(Console.ReadLine(), out result)); | |
return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install --assume-yes build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTodos(callback) { | |
var request = new XMLHttpRequest(); | |
request.open("Get", "/api/Todo", true); | |
request.onload = function() { | |
console.log("Returned"); | |
if (request.error) { | |
console.log(request.error); | |
} else { | |
var response = JSON.parse(request.responseText); | |
console.log(response); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTodos() { | |
var request = new XMLHttpRequest(); | |
request.open("Get", "/api/Todo", true); | |
request.onload = function() { | |
console.log("Returned"); | |
if (request.error) { | |
console.log(request.error); | |
} else { | |
var response = JSON.parse(request.responseText); | |
console.log(response); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.Linq.Mapping; | |
using System.Linq; | |
[Table(Name="Todos")] | |
public class Todo | |
{ | |
[Column(IsPrimaryKey = true, IsDbGenerated = true)] | |
public int Id { get; set; } | |
[Column] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.Linq; | |
using MvcTutorialTwo.Models; | |
public class ConnectionManager | |
{ | |
public const string ConnectionString = | |
"Data Source=localhost;Database=TodoCS2450;Integrated Security=True;"; | |
public static Table<Todo> GetTodoContext() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DbUpdater | |
{ | |
public void RunUpdate() | |
{ | |
const string connectionString = ConnectionManager.ConnectionString; | |
var updater = DbUp.DeployChanges.To | |
.SqlDatabase(connectionString) | |
.WithScriptsEmbeddedInAssembly(GetType().Assembly) | |
.LogToConsole() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE Todos | |
( | |
Id INT PRIMARY KEY IDENTITY(1, 1), | |
Title VARCHAR(255) NOT NULL, | |
Completed BIT NOT NULL DEFAULT(0), | |
DateAdded DATETIME NOT NULL DEFAULT(GETDATE()) | |
) | |
GO | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Access using - <link rel="stylesheet" type="text/css" href="/Content/home.css"/> */ | |
body { | |
} | |
ul { | |
list-style: none | |
} | |
.completed { | |
text-decoration: line-through |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model dynamic | |
@{ | |
Layout = null; | |
} | |
<!DOCTYPE html> | |
<html> | |
<head> |