Created
November 22, 2016 19:09
-
-
Save camarin24/6d2f56daabf9be73636de614cc5b8c39 to your computer and use it in GitHub Desktop.
TypeScript Interfaces implementations
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
interface IRepository<T>{ | |
Delete(Entity:T):T; | |
Update(Entity:T):T; | |
Create(Entity:T):T; | |
} | |
class IComprasRepository implements IRepository<ComprasModel>{ | |
private _url:string; | |
constructor(url:string){ | |
this._url = url; | |
} | |
Delete(Entity:ComprasModel){ | |
return Entity; | |
} | |
Update(Entity:ComprasModel){ | |
return Entity; | |
} | |
Create(Entity:ComprasModel){ | |
console.log("Se inserto en la url:" + this._url); | |
console.log(Entity.ProductoId); | |
console.log(Entity.Producto); | |
console.log(Entity.Descripcion); | |
return Entity; | |
}; | |
} | |
class ComprasService extends IComprasRepository{ | |
constructor(url:string){ | |
super(url); | |
}; | |
} | |
function Insertar(){ | |
let service = new ComprasService("/ComprasService"); | |
service.Create({Descripcion:"Esto es una descripción",Producto:"Cebollas",ProductoId:15}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment