Skip to content

Instantly share code, notes, and snippets.

@ktutnik
Last active January 19, 2017 02:36
Show Gist options
  • Save ktutnik/d468fdd243a6e3247e66d8b4736c24a8 to your computer and use it in GitHub Desktop.
Save ktutnik/d468fdd243a6e3247e66d8b4736c24a8 to your computer and use it in GitHub Desktop.
export class ProductController{
async getByPage(offset:number, pageWidth = 50){
return await factory.getProducts(offset, pageWidth);
}
async get(id:number){
return await factory.getProductById(id);
}
async add(model){
if(this.valid()){
await factory.save(model);
return true;
}
else {
return this.getValidation();
}
}
async modify(id, model){
if(this.valid()){
await factory.save(id, model);
return true;
}
else {
return this.getValidation();
}
}
async delete(id:number){
await factory.delete(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment