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)); } }
public bool AddNewProductOrder(NewProductOrderDTO newProductOrder) { using (var db = new SqlConnection(_connectionString)) { var sql = @" INSERT INTO [ProductOrder] (ProductId, OrderId, QuantityOrdered, isShipped, ShippedDate) OUTPUT INSERTED.* VALUES (@ProductId, @OrderId, @QuantityOrdered, @isShipped, null)"; return(db.Execute(sql, newProductOrder) == 1); } }
public void Add(NewProductOrderDTO newProductOrder) { _repo.AddNewProductOrder(newProductOrder); }