Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //KREIRANJE
  2. Project.Products.create({
  3.             //ProductID : 42066798, // vec kot 500 000 za zihr
  4.             ProductName : 'Extra Very Hot Sauce',
  5.             SupplierID : 10,
  6.             CategoryID : 2,
  7.             QuantityPerUnit : 10,
  8.             UnitPrice : 666,
  9.             UnitsInStock : 2500,
  10.             UnitsOnOrder : 10,
  11.             ReorderLevel : 5,
  12.             Discontinued : 0
  13.            
  14.         }).complete(function( err, prod){
  15.            console.log(err);
  16.            console.log("dodal v products");
  17.         })
  18.  
  19. //BRISANJE
  20. if(ass.ProductID == 42066798){
  21.                 ass.destroy().on('success',function(u){
  22.                     if(u && u.deletedAt){
  23.                         console.log("destroyed dis");
  24.                     }else{
  25.                         console.log("sumthin went rong mejbi");
  26.                     }
  27.                 })
  28.             }
  29.  
  30. //SPREMINJANJE
  31. Project.find({ where: {title: 'aProject'} }).on('success', function(project) {
  32.   if (project) { // if the record exists in the db
  33.     project.updateAttributes({
  34.       title: 'a very different title now'
  35.     }).success(function() {});
  36.   }
  37. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement