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()));
        }
 public ActionResult EditingAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Person person)
 {
     if (ModelState.IsValid)
     {
         list.AddPerson(person);
     }
     return(PartialView("GridViewTemplatePartial", list.GetPersons()));
 }
 public ActionResult EditingAddNew(Person person)
 {
     if (ModelState.IsValid)
     {
         list.AddPerson(person);
     }
     return(PartialView("GridViewPartial", list.GetPersons()));
 }
コード例 #4
0
        public ActionResult EditingAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Person person, bool keepOpened)
        {
            if (ModelState.IsValid)
            {
                list.AddPerson(person);
            }

            ViewData["KeepOpened"]    = keepOpened;
            ViewData["EditingRowKey"] = person.PersonID;
            return(PartialView("GridViewEditingPartial", list.GetPersons()));
        }