public void Edit(int id) { var model = fakedb.GetStudentById(id); if (model != null) { UserView view = new UserView(model); var r = view.ShowDialog(); if (r.Value) { var newModel = GridModelList.FirstOrDefault(t => t.Id == model.Id); if (newModel != null) { newModel.Name = model.Name; } } } }