예제 #1
0
        public static IEnumerable<ValidationError> ValidateNewPlayer(PlayerCreateCommand command)
        {
            var errors = new List<ValidationError>();
            if(string.IsNullOrEmpty(command.Name))
                errors.Add(new ValidationError { Type = "Name Required", Message = "Name is required to continue." });

            return errors;
        }
예제 #2
0
 public static Player CreateFrom(PlayerCreateCommand command)
 {
     // NOTE: if the player entity creation become more complicted, break this into a entity creation factory.
     return new Player
     {
         Name = command.Name
     };
 }