From the course: C# Cross-Platform Development
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Deleting a note command
From the course: C# Cross-Platform Development
Deleting a note command
- [Instructor] Now let's go ahead and implement the DeleteNoteCommand. This command allows the user to delete an existing note in the HelloNote application. We'll continue to apply the command pattern and the same process we've done for all the previous commands up until this point. Let's start by creating a new DeleteNoteCommand. Let's go ahead and implement the ICommand interface and let's create our public Execute method. Now we need to create the property to store a reference to our AppDbContext, and next, we'll need to pass in a reference to the AppDbContext in the constructor. Once we modify the constructor, we'll simply set the _dbContext property equal to the dbContext instant that's passed into the constructor. Now it's time for us to implement the execute method from the ICommand interface. This method will contain the logic to delete an existing note. We'll start by calling Console.Writeline and pass in the…