Last active
December 27, 2015 10:09
-
-
Save warthurton/7309089 to your computer and use it in GitHub Desktop.
LightSwitch HTML Commanding with TheLightSwitchToolbox.WebApiCommanding.Server
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
/// <reference path="../GeneratedArtifacts/viewModel.js" /> | |
myapp.BrowsePerson.PeopleCommanding_ItemTap_execute = function (screen) { | |
$.post("../api/Command/FirstCommand", | |
{ Parameter1: screen.People.selectedItem.Id, Parameter2: screen.People.selectedItem.FirstName }, | |
function (data) { | |
if (data != null) { | |
screen.CommandReturn = data.Parameter2.toString(); | |
return true; | |
} | |
screen.CommandReturn = "Error calling WebAPI"; | |
return false; | |
}); | |
}; |
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
public HttpResponseMessage FirstCommand(CommandParameters commandParameters) | |
{ | |
var responseParameters = commandParameters; | |
responseParameters.Parameter2 = | |
"I did my job " + commandParameters.Parameter2 | |
+ " ID: " + commandParameters.Parameter1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment