public async Task <IEnumerable <Product> > GetAllProductsAsync(string orderBy) { if (!allowedOrderByQueries.Contains(orderBy)) { throw new InvalidOperationException($"Invalid \" {orderBy} \" orderBy query param. The allowed values are {string.Join(",", allowedOrderByQueries)}"); } var ProductsEntities = await CategoriesRepository.GetAllProducts(orderBy); return(mapper.Map <IEnumerable <Product> >(ProductsEntities)); }