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.
48 lines
1.4 KiB
48 lines
1.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Model
|
|
{
|
|
/// <summary>
|
|
/// A Recipe is a description of step and maybe some techniques, with an ingredient list to make a meal.<br/>
|
|
/// It is instantiated with a new unique four digit id, where the first one is 1.
|
|
/// </summary>
|
|
public class Recipe : BaseItem
|
|
{
|
|
/// <summary>
|
|
/// This static atrribute stand for the creation of a new id. It is incremented each time a new Recipe is instantiated.
|
|
/// </summary>
|
|
public static uint idIterator = 0;
|
|
|
|
/// <summary>
|
|
/// The title of the recipe.
|
|
/// </summary>
|
|
public string Title { get; set; }
|
|
|
|
/// <summary>
|
|
/// All the details about the preparation of the meal.
|
|
/// </summary>
|
|
public string Preparation { get; set; }
|
|
|
|
|
|
public Recipe(string description = "", string title = "", string preparation = "")
|
|
: base(idIterator+1000, description)
|
|
{
|
|
if (idIterator == 1000) throw new OverflowException("id has reach the maximum value.");
|
|
Title = title;
|
|
Preparation = preparation;
|
|
idIterator++;
|
|
}
|
|
|
|
|
|
public override string ToString()
|
|
{
|
|
return
|
|
$"[ Class -Recipe- ]\n\n" +
|
|
$"\t.Id - {Id}\n" +
|
|
$"\t.Description - {Description}\n" +
|
|
$"______\n\n";
|
|
}
|
|
}
|
|
}
|