public object Lookup(IIndexArgumentList args) { if (args.TryGetStringParameter("id") == "x") { return("passedX"); } return(_value); }
public object Lookup(IIndexArgumentList args) { if (args.TryGetStringParameter("id") == "x") { return("y"); } return(null); }
public object Lookup(IIndexArgumentList args) { var text = args.TryGetStringParameter("text"); if (text != null) { return(StarWars.AllEntities.Where(e => e.name.Contains(text))); } return(null); }
public object Lookup(IIndexArgumentList args) { var id = args.TryGetStringParameter("id"); if (id != null) { return(StarWars.AllEntities.FirstOrDefault(e => e.id == id && e is Starship)); } return(null); }
public object Lookup(IIndexArgumentList args) { var ep = args.TryGetStringParameter("episode"); ep = ep ?? "NEWHOPE"; Entity result; if (StarWars.Heroes.TryGetValue(ep, out result)) { return(result); } return(null); }
public object Lookup(IIndexArgumentList args) { var key = args.TryGetStringParameter(_paramName); if (key == null) { return(null); } object value; if (_values.TryGetValue(key, out value)) { return(value); } else { return(null); } }
public async Task <object> Lookup(IIndexArgumentList args) { var key = args.TryGetStringParameter(_paramName); if (key == null) { return(null); } object value; if (_values.TryGetValue(key, out value)) { return(await value.Delayed()); } else { return(null); } }
public object Lookup(IIndexArgumentList filter) { var all = new List <Dictionary <string, object> >(); foreach (var currName in _names) { all.Add(new Dictionary <string, object> { ["name"] = currName, ["length"] = (double)currName.Length }); } var name = filter.TryGetStringParameter("name"); if (name != null) { return(all.Where(e => (string)e["name"] == name)); } return(new AsyncError("Not found")); }
public object Lookup(IIndexArgumentList args) { var id = args.TryGetStringParameter("key"); var capitalize = args.TryGetBooleanParameter("capitalize") == true; id = id ?? "foo"; string result = null; if (id == "hello") { result = "world"; } else if (id == "foo") { result = "bar"; } else { result = null; } return(capitalize ? result?.ToUpper() : result); }