//public static void DeleteItem(int itemKey, MVCxGridViewBatchUpdateValues<GridDataItem, int> batchValues) //{ // try // { // var item = GridData.First(i => i.ID == itemKey); // GridData.Remove(item); // } // catch (Exception e) // { // batchValues.SetErrorText(itemKey, e.Message); // } //} protected static void LoadNewValues(itembuilding newItem, itembuilding postedItem) { newItem.Id = postedItem.Id; newItem.Name = postedItem.Name; newItem.Address = postedItem.Address; newItem.BuildingLicense = postedItem.BuildingLicense; newItem.CadastralNr = postedItem.CadastralNr; }
//public static void InsertNewItem(GridDataItem postedItem, MVCxGridViewBatchUpdateValues<GridDataItem, int> batchValues) //{ // try // { // var newItem = new GridDataItem() { ID = GridData.Count }; // LoadNewValues(newItem, postedItem); // GridData.Add(newItem); // } // catch (Exception e) // { // batchValues.SetErrorText(postedItem, e.Message); // } //} public static void UpdateItem(itembuilding postedItem, MVCxGridViewBatchUpdateValues <itembuilding, int> batchValues) { try { var editedItem = GridData.First(i => i.Id == postedItem.Id); LoadNewValues(editedItem, postedItem); } catch (Exception e) { batchValues.SetErrorText(postedItem, e.Message); } }