Esempio n. 1
0
        private static void ValidateCommand(LaunchBetCommand command)
        {
            if (command.EndDate <= DateTime.UtcNow)
            {
                throw new ArgumentException("End date is not valid");
            }

            if (string.IsNullOrEmpty(command.Description))
            {
                throw new ArgumentException("Description is not valid");
            }
        }
Esempio n. 2
0
 public async Task Handle(LaunchBetCommand command)
 {
     ValidateCommand(command);
     var bet = new Bet(command.BetId, command.Description, command.EndDate, command.Coins);
     await _betRepository.SaveAsync(bet);
 }