Example #1
0
 public Task <IEnumerable <Recipe> > GetRecipesByCategory(string category)
 {
     return(Task.Run(() => RecipesFactory
                     .GetRecipesWithBasicDetails()
                     .Where(x => x.Category.ToString() == category)));
 }
Example #2
0
 public List <string> GetInstructionsOfRecipe(string id)
 {
     return(RecipesFactory.GetInstructionsOfRecipe(id));
 }
Example #3
0
 public Task <IEnumerable <Recipe> > GetRecipesByTime(double maxTime)
 {
     return(Task.Run(() => RecipesFactory
                     .GetRecipesWithBasicDetails()
                     .Where(x => x.TimeInMinutes <= maxTime)));
 }
Example #4
0
 public void UpdateRecipe(Recipe updatedRecipe)
 {
     RecipesFactory.UpdateRecipe(updatedRecipe);
 }
Example #5
0
 public Task DeleteRecipe(string id)
 {
     return(Task.Run(() => RecipesFactory.DeleteRecipe(id)));
 }
Example #6
0
 public Task <IEnumerable <Recipe> > GetRecipeByIngredients(string[] ingredients)
 {
     return(Task.Run(() => RecipesFactory
                     .GetRecipesWithBasicDetails()
                     .Where(x => x.Ingredients.Any(i => ingredients.Contains(i.Name)))));
 }
Example #7
0
 public Task <Recipe> GetRecipeById(string id)
 {
     return(Task.Run(() => RecipesFactory.GetRecipeById(id)));
 }
Example #8
0
 public void AddRecipe(Recipe newRecipe)
 {
     RecipesFactory.AddRecipe(newRecipe);
 }