コード例 #1
0
        private void SaveAction(object obj)
        {
            var item = this;

            if (status == ChangeStatus.New)
            {
                var id = handphoneCollection.Add(item);
                if (id > 0)
                {
                    item.Id = id;
                    MessageBox.Show("Data Berhasil Disimpan");
                    item.ProducentName = ProducentSelected.Name;


                    this.source.Add(item);
                    this.sourceView.Refresh();
                    this.WindowClose();
                }
                else
                {
                    MessageBox.Show("Data Gagal Disimpan");
                }
            }
            else
            {
                var isUpdated = handphoneCollection.Update(item);
                if (isUpdated)
                {
                    MessageBox.Show("Data Berhasil Disimpan");
                    item.ProducentName = ProducentSelected.Name;
                    this.sourceView.Refresh();
                    this.WindowClose();
                }
                else
                {
                    MessageBox.Show("Data Gagal Disimpan");
                }
            }
        }