Last active
January 19, 2017 02:36
-
-
Save ktutnik/d468fdd243a6e3247e66d8b4736c24a8 to your computer and use it in GitHub Desktop.
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
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