//private static Random rnd = new Random(); public CellDto(int row, int column, CellTypeDto cellType) { //Name = "test " + rnd.Next(); Column = column; Row = row; CellType = cellType; }
public static CellTypeDto Create(int id, string type) { if (string.IsNullOrWhiteSpace(type)) { throw new ArgumentException("Is null or white space", nameof(type)); } lock (CellTypes) { if (CellTypes.TryGetValue(type, out CellTypeDto cellType)) { return(cellType); } lock (AllId) { if (id <= 0 || AllId.Contains(id)) { for (id = 1; AllId.Contains(id); id++) { } } type = char.ToUpper(type[0]) + type.Substring(1); cellType = new CellTypeDto(id, type); CellTypes.Add(type, cellType); AllId.Add(id); return(cellType); } } }
public UserDto(int id, string userName, int imageIndex, int turn, bool isTurn, CellTypeDto cellType) : base(id) { if (string.IsNullOrWhiteSpace(userName)) { throw new ArgumentNullException(nameof(userName)); } if (imageIndex < 0) { throw new ArgumentNullException(nameof(imageIndex)); } UserName = userName; ImageIndex = imageIndex; Turn = turn; IsTurn = isTurn; CellType = cellType; }
public CellDto(int id, int row, int column, CellTypeDto cellType) : this(column, row, cellType) { Id = id; }