Skip to content

Instantly share code, notes, and snippets.

@mokamoto
Created December 17, 2013 22:23
Show Gist options
  • Save mokamoto/8013711 to your computer and use it in GitHub Desktop.
Save mokamoto/8013711 to your computer and use it in GitHub Desktop.
public class MobileInventoryExtension {
public MobileInventoryExtension(ApexPages.StandardController c) {}
public MobileInventoryExtension(ApexPages.StandardSetController c) {}
@RemoteAction
public static String updateMerchandiseItem(String productId, Integer newInventory) {
List<Merchandise__c> m = [SELECT Id, Name, Price__c, Quantity__c from Merchandise__c WHERE Id =: productId LIMIT 1];
if(m.size() > 0) {
m[0].Quantity__c = newInventory;
try {
update m[0];
return '更新されました';
}
catch (Exception e) {
return e.getMessage();
}
}
else {
return '指定されたIDに該当する商品がありません';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment