Пример #1
0
 public IActionResult AddToCart(AddProductOrderDTO ProductOrderAdd)
 {
     if (_repo.AddProductOrder(ProductOrderAdd))
     {
         return Created($"user/{ProductOrderAdd.ProductId}", ProductOrderAdd);
     }
     else
     {
         return BadRequest();
     }
 }
Пример #2
0
 public bool AddProductOrder(AddProductOrderDTO NewProductOrder)
 {
     using (var db = new SqlConnection(_connectionString))
     {
         var OrderId = _orderRepo.FindCurrentOrder(NewProductOrder.UserId);
         var NewPO   = new NewProductOrderDTO();
         NewPO.OrderId         = OrderId;
         NewPO.ProductId       = NewProductOrder.ProductId;
         NewPO.QuantityOrdered = NewProductOrder.QuantityOrdered;
         NewPO.isShipped       = false;
         return(_productOrderRepo.AddNewProductOrder(NewPO));
     }
 }