Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi guys,
 
I'm in the middle of creating a desktop application that allows a user to insert their Organisation details into a database that uses Entity Framework.
 
So far, I've created CRUD operations to allow the user to add, delete and update data, which was straight forward.
 
When doing this, I'm using commands, as I am trying to use the MVVM design pattern.
 
But what I want to achieve is to allow the user to only enter one row of data into the database, so what would be the best way to achieve it?
 
I've looked at using a Flag as well as using a query. Here is the code I have currently;
 
private ICommand showAddCommand;
            public ICommand ShowAddCommand
            {
                get
                {
                    if (this.showAddCommand == null)
                    {
                        this.showAddCommand = new RelayCommand(this.SaveFormExecute, this.SaveFormCanExecute);
                    }
                    return this.showAddCommand;
                }
            }
 
            private bool SaveFormCanExecute()
            {
                return !string.IsNullOrEmpty(OrganisationName) //...
            }
 
            private void SaveFormExecute()
            {
                InsertOrganisations();
            }
 
so what would be the best way to do this? Any help will be appreciated.
 
Many thanks,
 
Greg.
Posted 17-Jan-13 23:36pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 495
1 Maciej Los 340
2 Richard MacCutchan 265
3 BillWoodruff 225
4 Mathew Soji 200
0 OriginalGriff 8,804
1 Sergey Alexandrovich Kryukov 7,457
2 DamithSL 5,689
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411028.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100