public object Lookup(IIndexArgumentList args) { int startAt = (int?)args.TryGetNumberParameter("startAt") ?? 0; int take = (int?)args.TryGetNumberParameter("take") ?? int.MaxValue; var result = new List <Customer>(); for (int i = 0; i < take; i++) { var customer = Customer.Get(i + startAt); if (customer == null) { break; } result.Add(customer); } return(result); }
public object Lookup(IIndexArgumentList args) { int?id = (int?)args.TryGetNumberParameter("id"); if (id.HasValue) { return(Customer.Get(id.Value)); } else { return(null); } }