public async Task <ActionResult> FindReportedRecipesPost(Guid id)
        {
            if (id == null)
            {
                return(RedirectToAction("FindReportedRecipes"));
            }

            string buttonClicked = Request.Form["SubmitButton"];

            if (buttonClicked == "Change")
            {
                var result = await _reportRecipeService.ApproveRecipeAsync(id);
            }
            else if (buttonClicked == "Delete")
            {
                var result = await _reportRecipeService.DeleteRecipeAsync(id);
            }
            else if (buttonClicked == "ChangeType")
            {
                string NewType = Request.Form["RecipeType"];
                if (NewType == "Fara restrictii")
                {
                    NewType = "Normal";
                }
                var result = await _reportRecipeService.ChangeTypeAsync(id, NewType);
            }
            //Save Record and Redirect
            return(RedirectToAction("FindReportedRecipes"));
        }
예제 #2
0
        public async Task <ActionResult> IndexPost(Guid id)
        {
            string buttonClicked = Request.Form["SubmitButton"];

            if (buttonClicked == "Send")
            {
                string Description = Request.Form["ReportDescription"];
                _reportRecipeService.AddReport(id, Description);
            }
            else if (buttonClicked == "Change")
            {
                var result = await _reportRecipeService.ApproveRecipeAsync(id);
            }
            else if (buttonClicked == "Delete")
            {
                var result = await _reportRecipeService.DeleteRecipeAsync(id);
            }
            else if (buttonClicked == "ChangeType")
            {
                string NewType = Request.Form["RecipeType"];
                if (NewType == "Fara restrictii")
                {
                    NewType = "Normal";
                }
                var result = await _reportRecipeService.ChangeTypeAsync(id, NewType);
            }
            return(RedirectToAction("Message"));
        }