Ejemplo n.º 1
0
        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>());
            }
        }
Ejemplo n.º 2
0
        public Task <IEnumerable <Vendor> > GetAsync(GetVendorRequest request)
        {
            var selected = from v in vendors
                           where v.VendorType == request.VendorType
                           select v;

            return(Task.FromResult(selected));
        }