internal void SaveRecipe(string username, Recipe recipe) { var old = RecipeRepository[username].SingleOrDefault(r => r.Id == recipe.Id); if (old != null) { RecipeRepository[username].Remove(old); } RecipeRepository[username].Add(recipe); }
/// <summary> /// Creates or updates a recipe for a specified user /// </summary> /// <param name="username">The username of the user</param> /// <param name="recipe">The recipe to be created or updated</param> public void Put(string username, Recipe recipe) { provider.SaveRecipe(username, recipe); }