Writing commands
We will now create our first command, which is a request for saving, updating, or deleting data, and a command handler, which will resolve what the command needs. Again, the controller is responsible for sending or dispatching the commands to the relevant handlers.
Now we are in the part where we are going to create commands for TourLists
and TourPackages
.
Let's create a folder inside the TourLists
directory of the Tour.Application
project and name it Commands
. Then, let's create three folders inside that folder and name them CreateTourList
, DeleteTourList
, and UpdateTourList
.
Now it's time to create some commands and command validators. Create two C# files inside the CreateTourList
folder:
// CreateTourListCommand.cs
using MediatR; … namespace Travel.Application.TourLists.Commands.CreateTourList {   public partial class CreateTourListCommand :     IRequest<int>   { …  &...