public ActionResult SaveUser(UserViewModel user)
        {
            SaveResultViewModel model = new SaveResultViewModel();

            if (!ModelState.IsValid)
            {
                model.Errors = new LinkedList<string>();
                foreach (ModelState modelState in ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        model.Errors.AddLast(error.ErrorMessage);
                    }
                }
            }

            return View("Result", model);
        }
Ejemplo n.º 2
0
 public ActionResult SimpleServerValidation()
 {
     UserViewModel userViewModel = new UserViewModel();
     return View(userViewModel);
 }