Ejemplo n.º 1
0
 public ActionResult AddPerson(Person person)
 {
     if (ModelState.IsValid == false)
     {
         return(RedirectToAction(nameof(Index)));
     }
     return(RedirectToAction(nameof(Index)));
 }
Ejemplo n.º 2
0
        public ActionResult ValidateEditPersonEdit(Person person)
        {
            //var html = ConvertirVueString("_PersonEditView", person);
            JsonSerializerSettings sets = new JsonSerializerSettings
            {
                PreserveReferencesHandling = PreserveReferencesHandling.Objects
            };

            var errors = new ModelErrors(ModelState).MessagesWithKeys();

            // var errors = JsonConvert.SerializeObject(ModelState.Values.Select(m => m.Errors).Where(e => e.Count > 0), sets);

            return(ModelState.IsValid ?
                   Json(new { success = true }, JsonRequestBehavior.AllowGet)
                : Json(new { success = false, errors }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
 public ActionResult GetPersonEditView(Person person)
 {
     return(PartialView("_PersonEditView", person));
 }