Example #1
0
        public RecipeViewModel(
            IRecipeRepo recipeRepo
            , IMvxShareTask shareTask
            , IMvxMessenger messenger)
        {
            _recipeRepo = recipeRepo;
            _shareTask  = shareTask;
            _messenger  = messenger;

            var isIdle = this.WhenAny(x => x.IsCountingDown, x => !x.Value);

            _addActivityCommand = ReactiveCommand.Create(() => AddActivity());
            _openCommand        = ReactiveCommand.Create(() => Open());
            _resetTimersCommand = ReactiveCommand.Create(() => ResetTimers());
            _saveCommand        = ReactiveCommand.Create(() => Save());
            _shareCommand       = ReactiveCommand.Create(() => Share());

            _token = messenger.SubscribeOnMainThread <LoadRecipeMessage>(OnLoadRecipe);

            int nr = new Random().Next(0, 200);

            LoadRecipe(new Recipe {
                Name = "Stampot #" + nr
            });
        }
 public CategoriesController(IGenericRepo <Category> genericRepo, IRecipeRepo genericRecipeRepo, IMapper mapper, ILogger <CategoriesController> logger, IMemoryCache memoryCache, IHubContext <RepoHub> hubContext)
 {
     // _context = context;  //hier geen context meer bij een repo pattern.
     this.genericRepo       = genericRepo;
     this.genericRecipeRepo = genericRecipeRepo;
     this.mapper            = mapper;
     this.logger            = logger;
     this.memoryCache       = memoryCache;
     this.hubContext        = hubContext;
 }
Example #3
0
        public CookbookViewModel(
            IRecipeRepo recipeRepo,
            IMvxMessenger messenger)
        {
            _recipeRepo = recipeRepo;
            _messenger  = messenger;

            _openRecipeCommand = ReactiveCommand.Create <Recipe>((r) => OpenRecipe(r));

            ShowAllRecipes();
        }
Example #4
0
 public StockViewModel(IIngredientRepo ingredientRepo, Business.IProductRepo productRepo, IRecipeRepo recipeRepo)
 {
     _ingredientRepo              = ingredientRepo;
     _recipeRepo                  = recipeRepo;
     _productRepo                 = productRepo;
     SetProductsToggledCommand    = new RelayCommand(SetProductsToggled);
     SetIngredientsToggledCommand = new RelayCommand(SetIngredientsToggled);
     AddDataCommand               = new RelayCommand(AddData);
     EditIngredientCommand        = new RelayCommand <Ingredient>(EditIngredient, (_) => SelectedIngredient != null);
     EditProductCommand           = new RelayCommand <Product>(EditProduct, (_) => SelectedProduct != null);
     DeleteIngredientCommand      = new RelayCommand <Ingredient>(DeleteIngredient, (_) => SelectedIngredient != null);
     DeleteProductCommand         = new RelayCommand <Product>(DeleteProduct, (_) => SelectedProduct != null);
 }
Example #5
0
        public TableAddSaleProductViewModel(Data.Occupancy occupancy, Data.SubCategory subCategory, IRecipeRepo recipeRepo, IIngredientRepo ingredientRepo, IProductRepo productRepo, IOccupanciesRepo iOccupanciesRepo, ObservableCollection <SuggestedProducts> suggestedProducts)
        {
            _suggestedProducts        = suggestedProducts;
            _occupancy                = occupancy;
            _iOccupanciesRepo         = iOccupanciesRepo;
            _iRecipeRepo              = recipeRepo;
            _iIngredientRepo          = ingredientRepo;
            _iProductRepo             = productRepo;
            SubCategory               = subCategory;
            MinusAmountCommand        = new RelayCommand(MinusAmount);
            PlusAmountCommand         = new RelayCommand(PlusAmount);
            SetSelectedProductCommand = new RelayCommand <Business.Product>(SetSelectedProduct);

            AddSaleCommand  = new RelayCommand(AddSale, CanAddSale);
            ViewBackCommand = new RelayCommand(ViewBack);
        }
Example #6
0
        /// <summary>
        /// Constructor to add a product.
        /// Initializes the commands, sets the repositories.
        /// </summary>
        /// <param name="categoryRepo"><inheritdoc cref="_categoryRepo"/></param>
        /// <param name="recipeRepo"><inheritdoc cref="_recipeRepo"/></param>
        /// <param name="ingredientRepo"><inheritdoc cref="_ingredientRepo"/></param>
        public StockAddOrEditProductViewModel(ICategoryRepo categoryRepo, IRecipeRepo recipeRepo, IIngredientRepo ingredientRepo)
        {
            ActionToTake    = "add";
            _categoryRepo   = categoryRepo;
            _recipeRepo     = recipeRepo;
            _ingredientRepo = ingredientRepo;
            IsProductNotSet = true;

            SelectedRecipeItem         = new RecipeItem();
            SelectedRecipeItem.Product = new Product();
            DeleteRecipeItemCommand    = new RelayCommand <RecipeItem>(DeleteRecipeItem, (r) => r != null);
            BackToStockCommand         = new RelayCommand(BackToStock);
            AddProductCommand          = new RelayCommand(AddProduct);
            AddRecipeItemCommand       = new RelayCommand <RecipeItem>(AddRecipeItem, (_) =>
            {
                if (RecipeItemCanBeAdded())
                {
                    return(true);
                }
                return(false);
            });
        }
 public RecipesController(IMapper mapper, IGenericRepo <Category> categoryRepo, IRecipeRepo recipeRepo)
 {
     this.mapper       = mapper;
     this.categoryRepo = categoryRepo;
     this.recipeRepo   = recipeRepo;
 }
 public TandooriRecipeController(IRecipeRepo repository)
 {
     repo = repository;
 }
Example #9
0
 public RecipesController(ILogger <RecipesController> logger, IRecipeRepo recipeRepo)
 {
     _logger     = logger;
     _recipeRepo = recipeRepo;
 }
 public AdminManageRecipeServices(IRecipeRepo recipeRepository)
 {
     _recipeRepository = recipeRepository;
 }
 public RecipesController(IRecipeRepo recipeRepo)
 {
     _recipeRepo = recipeRepo;
 }
Example #12
0
 //Recipe Service is dependent on the IRecipeRepo
 public RecipeService(IRecipeRepo recipeRepository, IUserRepo userRepository, IIngredientService ingredientService)
 {
     _recipeRepository  = recipeRepository;
     _userRepository    = userRepository;
     _ingredientService = ingredientService;
 }
Example #13
0
 public RecipeService(IRecipeRepo recipeRepo)
 {
     _RecipeRepo = recipeRepo;
 }
Example #14
0
 public ViewResult InsertPage(Recipe recipe)
 {
     IRecipeRepo.AddRecipe(recipe);
     return(View("DataPage", IRecipeRepo.Recipes));
 }
Example #15
0
 public AdminController(IRecipeRepo repo)
 {
     repository = repo;
 }
Example #16
0
 public RecipeController(IRecipeRepo recipeRepo, IMapper mapper)
 {
     _repository = recipeRepo;
     _mapper     = mapper;
 }