Beispiel #1
0
        public void ValidateRow(DevExpress.Mvvm.Xpf.RowValidationArgs args)
        {
            var item    = (EntityFrameworkIssues.Issues.Issue)args.Item;
            var context = new EntityFrameworkIssues.Issues.IssuesContext();

            context.Entry(item).State = args.IsNewItem ? EntityState.Added : EntityState.Modified;
            try {
                context.SaveChanges();
            } finally {
                context.Entry(item).State = EntityState.Detached;
            }
        }
        void OnValidateRow(System.Object sender, DevExpress.Xpf.Grid.GridRowValidationEventArgs e)
        {
            var row     = (EntityFrameworkIssues.Issues.Issue)e.Row;
            var context = new EntityFrameworkIssues.Issues.IssuesContext();

            context.Entry(row).State = e.IsNewItem
                ? EntityState.Added
                : EntityState.Modified;
            try {
                context.SaveChanges();
            } finally {
                context.Entry(row).State = EntityState.Detached;
            }
        }
        void OnValidateRowDeletion(System.Object sender, DevExpress.Xpf.Grid.GridValidateRowDeletionEventArgs e)
        {
            var row     = (EntityFrameworkIssues.Issues.Issue)e.Rows.Single();
            var context = new EntityFrameworkIssues.Issues.IssuesContext();

            context.Entry(row).State = EntityState.Deleted;
            context.SaveChanges();
        }
        public void ValidateRowDeletion(DevExpress.Mvvm.Xpf.ValidateRowDeletionArgs args)
        {
            var item    = (EntityFrameworkIssues.Issues.Issue)args.Items.Single();
            var context = new EntityFrameworkIssues.Issues.IssuesContext();

            context.Entry(item).State = EntityState.Deleted;
            context.SaveChanges();
        }