Example #1
0
        public async Task <ActionResult <ShoppingCarts> > PostShoppingCarts(AddCartInput aci)
        {
            ShoppingCarts shoppingCarts = new ShoppingCarts
            {
                Count     = aci.Count,
                Size      = aci.Size,
                ProductId = aci.ProductId
            };

            _context.ShoppingCarts.Add(shoppingCarts);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetShoppingCarts", new { id = shoppingCarts.Id }, shoppingCarts));
        }
Example #2
0
        public async Task AddToCart(AddCartInput addCartInput)
        {
            var exisingFood = await _purchaseOrderRepository.FirstOrDefaultAsync(m => (m.FoodId == addCartInput.FoodId) && (m.Customer == addCartInput.Customer) && (m.Status == "InCart"));

            if (exisingFood != null)
            {
                exisingFood.Quantity++;
            }
            else
            {
                PurchaseOrder purchaseOrder = new PurchaseOrder()
                {
                    Customer = addCartInput.Customer,
                    Quantity = 1,
                    FoodId   = addCartInput.FoodId,
                    Status   = purchaseStatus,

                    DateCreated = DateTime.UtcNow
                };

                _purchaseOrderRepository.Insert(purchaseOrder);
                var ordermapped = ObjectMapper.Map <PurchaseOrderDto>(purchaseOrder);
            }
        }
 public BaseResponseModel <bool> AddToCart(AddCartInput addCart)
 {
     return(ResponsePack.Responsing(orderService.ADDToCart(userDataContent.userID, addCart.goodsID, addCart.goodsCount)));
 }
Example #4
0
 public void Add(AddCartInput input)
 {
     this.InsertFromDto(input);
 }
        public Task CreateCart(AddCartInput input)
        {
            var userId = GetUserId();

            return(_cartManager.CreateCart(new Cart(input.TenantId, "", userId)));
        }