protected void GridProviderView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { string id = e.Keys[0].ToString(); controller.Delete(id); e.Cancel = true; GridProviderView.CancelEdit(); Bind(); }
protected void GridProviderView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { CoreViewModel model = new CoreViewModel(); model.Address = e.NewValues["Address"].ToString(); model.Bank = e.NewValues["Bank"].ToString(); model.City = e.NewValues["City"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.IBAN = e.NewValues["IBAN"].ToString(); model.Name = e.NewValues["Name"].ToString(); model.PersonalIdentificationNumber = e.NewValues["PersonalIdentificationNumber"].ToString(); model.ProviderId = e.NewValues["ProviderId"] == null ? 0 : (int)e.NewValues["ProviderId"]; model.Title = e.NewValues["Title"].ToString(); model.BookingEmail = e.NewValues["BookingEmail"].ToString(); controller.Add(model); e.Cancel = true; GridProviderView.CancelEdit(); Bind(); }
protected void GridProviderView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { var list = (List <CoreViewModel>)GridProviderView.DataSource; CoreViewModel model = list.Find(m => m.Id == e.Keys[0].ToString()); model.Address = e.NewValues["Address"].ToString(); model.Bank = e.NewValues["Bank"].ToString(); model.City = e.NewValues["City"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.IBAN = e.NewValues["IBAN"].ToString(); model.Name = e.NewValues["Name"].ToString(); model.PersonalIdentificationNumber = e.NewValues["PersonalIdentificationNumber"].ToString(); model.ProviderId = e.NewValues["ProviderId"] == null ? 0 : (int)e.NewValues["ProviderId"]; model.Title = e.NewValues["Title"].ToString(); model.BookingEmail = e.NewValues["BookingEmail"].ToString(); controller.Update(model); e.Cancel = true; GridProviderView.CancelEdit(); Bind(); }