You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.6 KiB
62 lines
1.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Model
|
|
{
|
|
/// <summary>
|
|
/// Quantity is a class which is associate to Ingedients. It represents the quantity of every ingredient with an enum
|
|
/// to indicate the unit of the quantity.
|
|
/// </summary>
|
|
public class Quantity
|
|
{
|
|
#region Attributes
|
|
/// <summary>
|
|
/// get the quatity of ingredient
|
|
/// </summary>
|
|
private int number;
|
|
/// <summary>
|
|
/// have the Unit enum of the quantity of ingredient
|
|
/// </summary>
|
|
private Unit unit;
|
|
|
|
#endregion
|
|
/// <summary>
|
|
/// Represents the quantity in digits. The null value raise an argumentException.
|
|
/// </summary>
|
|
public int Number
|
|
{
|
|
get { return number; }
|
|
set
|
|
{
|
|
if (value < 0)
|
|
{
|
|
throw new ArgumentException("Si la quantité est inférieur à 0, enlever l'ingrédient!");
|
|
}
|
|
number = value;
|
|
}
|
|
}
|
|
public Unit UnitQ
|
|
{
|
|
get => unit;
|
|
set => unit = value;
|
|
}
|
|
|
|
|
|
#region Constructor
|
|
/// <summary>
|
|
/// Constructor of Quantity
|
|
/// </summary>
|
|
/// <param name="number"></param>
|
|
/// <param name="unit"></param>
|
|
public Quantity(int number, Unit unit)
|
|
{
|
|
Number = number;
|
|
UnitQ = unit;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|