Created
December 17, 2013 22:23
-
-
Save mokamoto/8013711 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
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