コード例 #1
0
ファイル: Player.cs プロジェクト: joeyshipley/ColorTime
        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
ファイル: Player.cs プロジェクト: joeyshipley/ColorTime
 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
     };
 }