Azure Mobile Services, Part 3: Listing 1

Del operation script with push notification.

function del(id, user, request) {
  var item = null;
  var sql = "SELECT * FROM ContactItem WHERE userId = ?";
    mssql.query(sql, [user.userId], {
        success: function(results) {
            if (results.length > 0) {
                 item = results[0];
            }
        }
    });
    
   request.execute({
        success: function() {
            request.respond();
            push.wns.sendToastText04(item.PushChannel, {
                text1: item.FirstName + " " + item.LastName + " was removed as a contact!"
            });
        }
    });
}

About the Author

Eric Vogel is a Senior Software Developer for Red Cedar Solutions Group in Okemos, Michigan. He is the president of the Greater Lansing User Group for .NET. Eric enjoys learning about software architecture and craftsmanship, and is always looking for ways to create more robust and testable applications. Contact him at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube