Пример #1
0
        public async Task<ActionResult> Create(Guid id)
        {
            var template = await this.encuestaTemplatesService.GetAsync(id);
            var nextOrden = template.Grupos.Count > 0 ? template.Grupos.Max(p => p.Orden) + 1 : 1;

            var model = new GrupoPreguntasViewModel { TemplateId = id, Habilitado = true, Orden = nextOrden };
            return this.View(model);
        }
Пример #2
0
        public async Task<ActionResult> Edit(GrupoPreguntasViewModel model)
        {
            if (ModelState.IsValid)
            {
                await this.grupoPreguntasService.CreateOrUpdateAsync(model);

                return this.RedirectToAction("Details", "Templates", new { id = model.TemplateId });
            }

            // If we got this far, something failed, redisplay form
            return this.View(model);
        }