示例#1
0
        public ActionResult AddOrEditSequencing(EditSequencingViewModel editSequencingViewModel)
        {
            Recipe recipe = _recipeProvider.GetRecipeById(editSequencingViewModel.RecipeId);
            IEnumerable <RecipeIngridientView> recipeIngridients = _recipeProvider.GetRecipeIngridientsByRecipeId(editSequencingViewModel.RecipeId);

            if (ModelState.IsValid)
            {
                _recipeProvider.UpdateRecipeDetailsSequencing(editSequencingViewModel.RecipeId, editSequencingViewModel.Sequencing);
                return(RedirectToAction("ShowFullRecipe", new { @recipeId = editSequencingViewModel.RecipeId }));
            }
            else
            {
                editSequencingViewModel = ParseEditSequencingViewModel(recipeIngridients, editSequencingViewModel.RecipeId, recipe.Name, editSequencingViewModel.Sequencing);
                return(View("ShowSequencingByRecipeId", editSequencingViewModel));
            }
        }