Esempio n. 1
0
        ActionResult ProcessDialog(DialogModel model, int answer, string message)
        {
            if (ModelState.IsValid)
            {
                if (model.Value == answer)
                    return this.DialogResult(message);  // Close dialog via DialogResult call
                else
                    ModelState.AddModelError("", string.Format("Invalid input value. The correct value is {0}", answer));
            }

            return PartialView(model);
        }
        ActionResult ProcessDialog(DialogModel model, int answer, string message)
        {
            if (this.ModelState.IsValid)
            {
                var data = new { id = answer, valor = "Mensagem " + answer };
                if (model.Value == answer)
                {
                    return this.DialogResult(message, data); // Close dialog via DialogResult call
                }

                this.ModelState.AddModelError(string.Empty, string.Format("Invalid input value. The correct value is {0}", answer));
            }

            return this.PartialView(model);
        }
Esempio n. 3
0
 ActionResult ProcessDialog(DialogModel model, int answer)
 {
     return ProcessDialog(model, answer, null);
 }
Esempio n. 4
0
 public ActionResult Dialog3(DialogModel model)
 {
     return ProcessDialog(model, 3);
 }
Esempio n. 5
0
 public ActionResult Dialog1(DialogModel model)
 {
     return ProcessDialog(model, 1, "Great, your answer is correct!");
 }
 public ActionResult Dialog2(DialogModel model)
 {
     return this.ProcessDialog(model, 2);
 }