Exemplo n.º 1
0
        public IActionResult EditProblem(EditProblemBindingModel bindingModel)
        {
            var bm          = problemsService.EditProblem(bindingModel);
            var redirectUrl = $"/{Area.Fun}/{Paths.Games}/{Actions.ProblemDetails}?{Query.Id}={bm.Id}";

            return(Redirect(redirectUrl));
        }
Exemplo n.º 2
0
        //Tested
        public GameProblem EditProblem(EditProblemBindingModel bindingModel)
        {
            var problem = this.context.GameProblems
                          .Include(x => x.Choices)
                          .FirstOrDefault(x => x.Id == bindingModel.Id);

            problem.ProblemContent = bindingModel.Content;
            problem.RightAnswer    = GetRightAnswerString(bindingModel);
            problem.Choices        = this.UpdateChoices(problem.Choices, bindingModel);
            this.context.SaveChanges();
            return(problem);
        }