public IEnumerable <Product> ProductsByIds(string idsString)
        {
            var ids = DataTransferHelper.IdsFromString(idsString);

            return(_repository.GetProducts()?
                   .ToList()
                   .Where(p => ids.Contains(p.ProductId))
                   .Select(productDto => FromDto(productDto)));
        }
        public async Task <Payment> CheckoutCart(
            [Service] PaymentsResolver resolver,
            string cartId,
            string addressId,
            string prescriptionId,
            string productIds,
            string customerId,
            string paymentInfoId,
            string amount)
        {
            var orderItems = !string.IsNullOrWhiteSpace(productIds)
                ? DataTransferHelper.IdsFromString(productIds)
                : default;

            return(await resolver.CheckoutOrder(orderItems?.Select(o => new OrderItem
            {
                Price = "",
                Quantity = "1",
                ProductId = o
            }), prescriptionId, cartId, customerId, addressId, paymentInfoId, amount));
        }
Esempio n. 3
0
        public IQueryable <OrderDto> GetOrders(string ids)
        {
            var idsList = DataTransferHelper.IdsFromString(ids);

            return(_ordersCollection.AsQueryable().Where(o => idsList.Contains(o.OrderId)));
        }