public void AddLocation(Recipe recipe, Location location) { var existing = Access.RecipeLocations.SingleOrDefault(x => x.Recipe == recipe && x.Location == location); if (existing != null) { throw new RecipeLocationAlreadyExistsError(); } var recipeLocation = new RecipeLocation { Recipe = recipe, Location = location }; Access.AddRecipeLocation(recipeLocation); }
public void AddRecipeLocation(RecipeLocation recipeLocation) { Context.RecipeLocations.Add(recipeLocation); }