/// <summary> /// Creates a burger if the name is unique otherwise throws an exception /// </summary> /// <param name="burgerData"></param> /// <returns></returns> public Burger AddBurger(Burger burgerData) { var exists = _repo.GetBurgerByName(burgerData.Name); if (exists != null) { throw new Exception("This burger already exists."); } burgerData.Id = Guid.NewGuid().ToString(); _repo.Create(burgerData); return(burgerData); }