This file contains 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
import * as ko from "../lib/knockout/dist/knockout"; | |
class WebMailViewModel { | |
// Data | |
folders: string[] = ["Inbox", "Archive", "Sent", "Spam"]; | |
chosenFolderId: KnockoutObservable<string> = new ko.observable(); | |
chosenFolderData: KnockoutObservable<Folder> = new ko.observable(); | |
chosenMailData: KnockoutObservable<Mail> = new ko.observable(); | |
goToFolder: (folder: string) => void; | |
goToMail: (mail: Mail) => void; |
This file contains 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.Collections.Generic; | |
namespace KnockoutTS.Models | |
{ | |
public class WebMail | |
{ | |
public List<Folder> Folders { get; set; } = new List<Folder>(); | |
} | |
public class Mail |
This file contains 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 KnockoutTS.Models; | |
using Microsoft.AspNetCore.Hosting; | |
using Newtonsoft.Json; | |
using System.IO; | |
using System.Linq; | |
namespace KnockoutTS.Services | |
{ | |
public interface IMailService | |
{ |
This file contains 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 void ConfigureServices(IServiceCollection services) | |
{ | |
services.Configure<CookiePolicyOptions>(options => | |
{ | |
// This lambda determines whether user consent for non-essential cookies is needed for a given request. | |
options.CheckConsentNeeded = context => true; | |
options.MinimumSameSitePolicy = SameSiteMode.None; | |
}); | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); |
This file contains 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 KnockoutTS.Models; | |
using KnockoutTS.Services; | |
using Microsoft.AspNetCore.Mvc; | |
namespace KnockoutTS.Controllers | |
{ | |
[Route("api/[controller]")] | |
public class MailController : Controller | |
{ |
This file contains 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
Show hidden characters
{ | |
"compileOnSave": true, | |
"compilerOptions": { | |
"noImplicitAny": false, | |
"noEmitOnError": true, | |
"removeComments": false, | |
"sourceMap": true, | |
"target": "es6", | |
"module": "amd" | |
}, |
This file contains 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 Customer | |
{ | |
public int CustomerId { get; set; } | |
public string Name { get; set; } | |
public ICollection<Order> Orders { get; set; } = new HashSet<Order>(); | |
} | |
public class Order | |
{ | |
public int OrderId { get; set; } |
This file contains 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 view OrderHeaders as | |
select c.Name as CustomerName, | |
o.DateCreated, | |
sum(oi.Price) as TotalPrice, | |
count(oi.Price) as TotalItems | |
from OrderItems oi | |
inner join Orders o on oi.OrderId = o.OrderId | |
inner join Customers c on o.CustomerId = c.CustomerId | |
group by oi.OrderId, c.Name, o.DateCreated |
This file contains 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 OrderHeader | |
{ | |
public string CustomerName { get; set; } | |
public DateTime DateCreated { get; set; } | |
public int TotalItems { get; set; } | |
public decimal TotalPrice { get; set; } | |
} |
This file contains 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 SampleContext : DbContext | |
{ | |
public DbSet<Order> Orders { get; set; } | |
public DbSet<OrderItem> OrderItems { get; set; } | |
public DbSet<Customer> Customers { get; set; } | |
public DbQuery<OrderHeader> OrderHeaders { get; set; } | |
... | |
} |