public ActionResult BatchEditingUpdateModelPerson(MVCxGridViewBatchUpdateValues <Person, int> batchValues)
        {
            foreach (var person in batchValues.Update)
            {
                if (batchValues.IsValid(person))
                {
                    PersonsList.UpdatePerson(person);
                }
                else
                {
                    batchValues.SetErrorText(person, "Correct validation errors");
                }
            }

            foreach (var person in batchValues.Insert)
            {
                if (batchValues.IsValid(person))
                {
                    PersonsList.AddPerson(person);
                }
                else
                {
                    batchValues.SetErrorText(person, "Correct validation errors");
                }
            }

            foreach (var personID in batchValues.DeleteKeys)
            {
                PersonsList.DeletePerson(personID);
            }
            return(PartialView("GridViewPartial", PersonsList.GetPersons()));
        }
コード例 #2
0
 public ActionResult Index()
 {
     return(View(list.GetPersons()));
 }
 public ActionResult GridViewPartial()
 {
     return(PartialView(list.GetPersons()));
 }