public async Task <IEnumerable <Vendor> > GetAsync(GetVendorRequest request) { if (services.ContainsKey(request.VendorType)) { if (string.IsNullOrWhiteSpace(request.Id)) { return(await services[request.VendorType].GetAsync()); } else { var vendors = new List <Vendor>(); var vendor = await services[request.VendorType].GetAsync(request.Id); if (vendor != null) { vendors.Add(vendor); } return(vendors); } } else { return(new List <Vendor>()); } }
public Task <IEnumerable <Vendor> > GetAsync(GetVendorRequest request) { var selected = from v in vendors where v.VendorType == request.VendorType select v; return(Task.FromResult(selected)); }