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.
SAE-2.01/MCTG/MCTGLib/Recipe.cs

36 lines
907 B

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace Model
{
public class Recipe : IEquatable<Recipe>
{
private static int idCreator = 0;
public int Id { get; init; }
public string Description { get; init; }
public string Title { get; set; }
public Recipe(string title, string description = "No Description.")
{
Id = idCreator++;
Title = title;
Description = description;
}
public bool Equals(Recipe? other)
{
if (other == null) return false;
if (other == this) return true;
return Title.Equals(other.Title) && Description.Equals(other.Description);
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
}
}