internal Task <IResult> GetApplications(IGetVendorsQuery getVendorsAndApplicationsQuery, IMapper mapper) { var vendors = getVendorsAndApplicationsQuery.Execute(); var applications = new List <ApplicationModel>(); foreach (var vendor in vendors) { applications.AddRange(mapper.Map <List <ApplicationModel> >(vendor.Applications)); } return(Task.FromResult(AdminApiResponse <List <ApplicationModel> > .Ok(applications))); }
internal Task <IResult> GetApplication(GetApplicationByIdQuery getApplicationByIdQuery, IMapper mapper, int id) { var application = getApplicationByIdQuery.Execute(id); if (application == null) { throw new NotFoundException <int>("application", id); } var model = mapper.Map <ApplicationModel>(application); return(Task.FromResult(AdminApiResponse <ApplicationModel> .Ok(model))); }
internal Task <IResult> GetVendor(IGetVendorByIdQuery getVendorByIdQuery, IMapper mapper, int id) { var vendor = getVendorByIdQuery.Execute(id); if (vendor == null) { throw new NotFoundException <int>("vendor", id); } var model = mapper.Map <VendorModel>(vendor); return(Task.FromResult(AdminApiResponse <VendorModel> .Ok(model))); }
internal Task <IResult> GetVendorApplications(GetApplicationsByVendorIdQuery getApplicationByVendorIdQuery, IMapper mapper, int id) { var vendorApplications = mapper.Map <List <ApplicationModel> >(getApplicationByVendorIdQuery.Execute(id)); return(Task.FromResult(AdminApiResponse <List <ApplicationModel> > .Ok(vendorApplications))); }
internal Task <IResult> GetVendors(IGetVendorsQuery getVendorsQuery, IMapper mapper) { var vendorList = mapper.Map <List <VendorModel> >(getVendorsQuery.Execute()); return(Task.FromResult(AdminApiResponse <List <VendorModel> > .Ok(vendorList))); }
internal Task <IResult> GetClaimSets(GetClaimSetNamesQuery getClaimSetsQuery) { var calimSets = getClaimSetsQuery.Execute().ToList(); return(Task.FromResult(AdminApiResponse <List <string> > .Ok(calimSets))); }