1import kb = Knockback;
2
3export module CustomerViewModels
4{
5 export class CustomerVM extends kb.ViewModel
6 {
7 Id: number;
8 FirstName: string;
9 LastName: string;
10 CompanyName: string;
11 SalesOrdersHeaders: kb.CollectionObservable;
12 }
13}
1function CreateKnockBackViewModel(cust, orders) {
2 var cvm = {
3 Id: kb.observable(cust,'Id'),
4 CompanyName: kb.observable(cust, 'CompanyName'),
5 FirstName: kb.observable(cust, 'FirstName'),
6 LastName: kb.observable(cust, 'LastName'),
7 SalesOrderHeaders: kb.collectionObservable(orders)
8 }
9 return cvm;
10}