public async Task <ActionResult> Index()
        {
            QuizModeType selectedModeType = await this.modesService.GetSelectedMode();

            var bindingModel = new QuizModeBindingModel {
                Type = selectedModeType
            };

            return(this.View(bindingModel));
        }
Пример #2
0
        public async Task <IHttpActionResult> Post([FromBody] QuizModeBindingModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            await this.modesService.UpdateMode(model.Type);

            return(this.Ok());
        }
        public async Task <ActionResult> Index(QuizModeBindingModel model)
        {
            if (this.ModelState.IsValid)
            {
                await this.modesService.UpdateMode(model.Type);

                this.TempData["Message"] = "Quiz mode changed";

                return(this.RedirectToAction <HomeController>(c => c.Index()));
            }

            return(this.View(model));
        }