public MappingContext(string connectionStringName) { string connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString; clientMapper = new ClientMapper(connectionString); productMapper = new ProductMapper(connectionString); discountMapper = new DiscountMapper(connectionString); discountPoliciesMapper = new DiscountPoliciesMapper(connectionString); }
public async Task <IEnumerable <DiscountModel> > GetAll([FromQuery] string[] selectedCategories, string discountName = null) { if (selectedCategories.Length == 0) { selectedCategories = null; } var categories = await _categoryApplicationService.GetCategoryListAsync(); IEnumerable <CategoryModel> categoriesModels = CategoryMapper.MapToCategoryModels(categories); var partners = await _adminQueryApplicationService.GetPartnersOnly(selectedCategories, discountName); IEnumerable <DiscountModel> discounts = DiscountMapper.MapToDiscountModel(partners, categoriesModels); return(discounts); }