using System; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq; using LeanCloud.Storage; using LeanCloud.Engine; namespace web { public class App { // Function [LCEngineFunction("ping")] public static string Ping() { return "pong"; } [LCEngineFunction("hello")] public static string Hello([LCEngineFunctionParam("name")] string name) { string msg = $"hello, {name}"; Console.WriteLine(msg); return msg; } [LCEngineFunction("getObject")] public static async Task GetObject([LCEngineFunctionParam("className")] string className, [LCEngineFunctionParam("id")] string id) { LCQuery query = new LCQuery(className); return await query.Get(id); } [LCEngineFunction("getObjects")] public static async Task> GetObjects() { LCQuery query = new LCQuery("Account"); query.WhereGreaterThan("balance", 100); return await query.Find(); } [LCEngineFunction("getObjectMap")] public static async Task> GetObjectMap() { LCQuery query = new LCQuery("Todo"); ReadOnlyCollection todos = await query.Find(); return todos.ToDictionary(t => t.ObjectId); } } }