first// ---------------------------------------------------------------------------------------------------------------------
// <copyright file="Order.cs" company="Microsoft">
// Order
// </copyright>
// <summary>
// Defines the Order type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
namespace FabrikamSports
{
using System;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Order Class for FabrikamSports
/// </summary>
public class Order
{
/// <summary>
/// Checks if the product is available and places the order.
/// </summary>
/// <param name="product">The product.</param>
/// <param name="quantity">The quantity.</param>
/// <returns>Returns true if product is available</returns>
public bool Fill(Product product, int quantity)
{
top0000,1if (product == null)
{
0003,1throw new ArgumentException();
}
// Check if WareHouse has any inventory
0009,1Warehouse orderWareHouse = new Warehouse();
000f,1if (orderWareHouse.HasInventory(product, quantity))
{
// Subtract the quantity from the product in the warehouse
0019,1orderWareHouse.Remove(product, quantity);
0021,3return true;
}
0023,1return false;
}
}
}