// GET: Ingredient
        public ActionResult Index()
        {
            var ingredients = _ingredientManager.GetAllIngredients();


            return(View(ingredients));
        }
예제 #2
0
        public JsonResult GetInitData()
        {
            var viewModel = new IngredientMixingViewModel();

            viewModel.Ingredients     = _ingredientManager.GetAllIngredients();
            viewModel.Effects         = _ingredientManager.GetAllEffects();
            viewModel.Moods           = _ingredientManager.GetAllMoods();
            viewModel.IngredientMixes = _ingredientManager.GetAllMixes();

            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Edit(int?id)
        {
            var result = new RecipeEditViewModel();

            if (id.HasValue)
            {
                result.Recipe = _recipeManager.GetRecipe(id.Value);
            }
            else
            {
                result.Recipe = new Recipe();
            }
            result.Effects     = _ingredientManager.GetAllEffects();
            result.Moods       = _ingredientManager.GetAllMoods();
            result.Ingredients = _ingredientManager.GetAllIngredients();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public ActionResult GetData(int?dataId)
        {
            var ingredients = _ingredientManager.GetAllIngredients();
            var grid        = new GenericReactGrid(new List <string> {
                "Name", "Description", "Color"
            }, dataId ?? 0);

            foreach (var rowData in ingredients)
            {
                grid.GridRow.Add(new Dictionary <string, object>
                {
                    { "col1", rowData.Name },
                    { "col2", rowData.Description },
                    { "col3", rowData.Color },
                    { "id", rowData.Id },
                    //{"updateUrl", Url.Action()},
                    //{"deleteUrl", Url.Action("Delete", "") },
                    //{"deleteParams", new Dictionary<string, object>{{"type", "" }}}
                });
            }

            return(Json(new GenericReactTableResult(grid), JsonRequestBehavior.AllowGet));
        }
예제 #5
0
 public List <IngredientDto> GetAllIngredients()
 {
     return(_ingredientManager.GetAllIngredients());
 }