public RecipeController(IRecipeProvider recipeProvider, ICategoryProvider categoryProvider, IIngridientProvider ingridientProvider) { ProvidersFactory factory = new ProvidersFactory(); if (recipeProvider != null) { _recipeProvider = recipeProvider; } else { _recipeProvider = factory.GetRecipeProvider(); } if (categoryProvider != null) { _categoryProvider = categoryProvider; } else { _categoryProvider = factory.GetCategoryProvider(); } if (ingridientProvider != null) { _ingridientProvider = ingridientProvider; } else { _ingridientProvider = factory.GetIngridientProvider(); } }
public DietController(RequirementsProvider requirementsProvider, NsgaSolverFactory nsgaSolverFactory, IRecipeProvider recipeProvider) { _requirementsProvider = requirementsProvider; _nsgaSolverFactory = nsgaSolverFactory; _recipeProvider = recipeProvider; RInvoker.Path = HostingEnvironment.MapPath(@"~/Content"); }
public RecipeModule(IRecipeProvider recipeProvider) : base("recipe") { Get("/", ctx => { var recipes = recipeProvider.GetAll(); return(ctx.Response.AsJson(recipes)); }); Get("/{id:int}", ctx => { var id = ctx.GetRouteData().As <int>("id"); var recipe = recipeProvider.GetById(id); if (recipe != null) { return(ctx.Response.AsJson(recipe)); } else { ctx.Response.StatusCode = 404; return(ctx.Response.WriteAsync($"No recipe with id {id} was found")); } }); Post("/", ctx => { var recipe = ctx.Request.Bind <Recipe>(); var addedRecipe = recipeProvider.Add(recipe); return(ctx.Response.AsJson(addedRecipe)); }); Put("/{id:int}", ctx => { var id = ctx.GetRouteData().As <int>("id"); var newRecipe = ctx.Request.Bind <Recipe>(); if (id != newRecipe.Id) { ctx.Response.StatusCode = 400; return(ctx.Response.WriteAsync("Cant update Id property")); } var editedRecipe = recipeProvider.Update(id, newRecipe); return(ctx.Response.AsJson(editedRecipe)); }); Delete("/{id:int}", ctx => { var id = ctx.GetRouteData().As <int>("id"); recipeProvider.Delete(id); ctx.Response.StatusCode = 204; return(Task.CompletedTask); }); }
public RecipesController( ICookingProcedureProvider cookingProcedureProvider, IIngredientProvider ingredientProvider, IIngredientMapper ingredientMapper, IRecipeProvider recipeProvider, IRecipeMapper recipeMapper, IPdfGenerator pdfGenerator, IScraper scraper, IRecipeParser RecipeParser, ISiteSettingsProvider siteSettingsProvider, IFileHandler fileHandler ) { this.cookingProcedureProvider = cookingProcedureProvider; this.ingredientProvider = ingredientProvider; this.ingredientMapper = ingredientMapper; this.recipeProvider = recipeProvider; this.recipeMapper = recipeMapper; this.pdfGenerator = pdfGenerator; this.scraper = scraper; this.RecipeParser = RecipeParser; this.siteSettingsProvider = siteSettingsProvider; this.fileHandler = fileHandler; }
public void PrintRecipe(IRecipeProvider recipe) { File.WriteAllText("Recipe.txt", recipe.GetTextToPrint()); }
public FetchDataViewModels(IRecipeProvider recipeProvider) { _recipeProvider = recipeProvider; }
public App(IRecipeProvider recipeProvider, ILogger <App> logger) { this.recipeProvider = recipeProvider ?? throw new ArgumentNullException(nameof(recipeProvider)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public RecipeLookup(IRecipeProvider provider, IConfiguration config) { _provider = provider; _config = config; }
public void RemoveRecipeProvider(IRecipeProvider provider) { Mod.Recipes.RemoveProvider(provider); }
public void AddRecipeProvider(IRecipeProvider provider) { Mod.Recipes.AddProvider(provider); }
public RecipeController(IRecipeProvider recipeProvider) { _recipeProvider = recipeProvider; }
public SearchController( IRecipeProvider recipeProvider ) { this.recipeProvider = recipeProvider; }
public void PrintRecipe(IRecipeProvider recipe) { Console.WriteLine(recipe.GetTextToPrint()); }
/// <summary> /// Initializes a new instance of the <see cref="RecipeDownload"/> class. /// </summary> /// <param name="recipeRepository">The recipe repository.</param> /// <param name="recipeProvider">The recipe provider.</param> /// <param name="logger">The logger.</param> public RecipeDownload( IRecipeRepository recipeRepository, IRecipeProvider recipeProvider, ILogger logger) => (_recipeRepository, _recipeProvider, _logger) = (recipeRepository, recipeProvider, logger);
public MealPlanGenerator(IRecipeProvider recipeProvider) { _recipeProvider = recipeProvider; }
public TagsController( IRecipeProvider recipeProvider ) { this.recipeProvider = recipeProvider; }