public void AddDonut(Donut d) { if (context.catalog.products.ContainsKey(d.Id)) { throw new Exception("No such Donut in our DONOT shop"); } context.catalog.products.Add(d.Id, d); }
public void UpdateDonutInfo(Donut D) { if (context.catalog.products.ContainsKey(D.Id)) { context.catalog.products[D.Id].Name = D.Name; context.catalog.products[D.Id].Price = D.Price; context.catalog.products[D.Id].Filling = D.Filling; return; } throw new Exception("No such Donut in our DONOT shop"); }
public bool Equals(Donut other) { return(this.Id == other.Id & this.Name == other.Name); }