public WheelOfFortune(Guid id, int number, WheelOfFortuneColors color, DateTime date) { Id = id; Number = number; Color = color; Date = date; }
public Task <bool> Handle(RegisterNewRoundCommand request, CancellationToken cancellationToken) { Random rnd = new Random(); Array values = Enum.GetValues(typeof(WheelOfFortuneColors)); WheelOfFortuneColors randomColor = (WheelOfFortuneColors)values.GetValue(rnd.Next(values.Length)); var wheelOfFortune = new WheelOfFortune(request.Id, request.Number, request.Color, request.Date); wheelOfFortune.Number = rnd.Next(1, 37); wheelOfFortune.Color = GetColorByNumber(wheelOfFortune.Number); wheelOfFortune.Date = DateTime.Now; _repository.Add(wheelOfFortune); Commit(); return(Task.FromResult(true)); }
public RegisterNewRoundCommand(int number, WheelOfFortuneColors color, DateTime date) { Number = number; Color = color; Date = date; }