示例#1
0
        public ActionResult ValidationMessages(ValidationMessagesViewModel model, string submitType)
        {
            AddErrorMessage("Error --> you are on the Validation Page.");
            AddSuccessMessage("Success --> you are on the Validation Page.");
            AddWarningMessage("Warning --> you are on the Validation Page.");
            AddInformationMessage("Info --> you are on the Validation Page.");

            AddWarningMessage("FieldWithAWarning", "An error has occurred on 'Field with a warning'");
            AddInformationMessage("FieldWithInformation", "Some information about 'Field with information'");
            AddInformationMessage("FieldWithMoreInformation", "Some more information");
            AddErrorMessage("FieldWithAnError", "An error has occurred on 'Field with an error'");

            if (submitType == "success")
            {
                AddSuccessMessage("Success --> you are on the Validation Page.");
                AddSuccessMessage("FieldWithASuccess", "Success for the 'Field with a success'");
            }
            else if (submitType == "errors")
            {
                AddErrorMessage("Error --> you are on the Validation Page.");
                AddErrorMessage("FieldWithAnError", "An error has occurred on 'Field with an error'");
                AddErrorMessage("FieldWithAnotherError", "Another error on that field");
            }

            return(View(model));
        }
示例#2
0
        public ActionResult ValidationMessages()
        {
            var model = new ValidationMessagesViewModel();

            return(View(model));
        }