private bool ValidateGameSlotType(Game gameInfo) { bool isValid = false; GameUser gameUser = _gameUserService.Get(x => x.UserId == User.FindFirst(ClaimTypes.NameIdentifier).Value); if (gameUser != null && gameUser.LastPlayedDate != null) { TimeSpan diffDate = DateTime.UtcNow - Convert.ToDateTime(gameUser.LastPlayedDate); switch (gameInfo.GameSlotType) { case (int)Game.GameSlotTypeEnum.OncePerWeek: isValid = diffDate.Days > 7; break; case (int)Game.GameSlotTypeEnum.OncePerMonth: isValid = diffDate.Days > 30; break; case (int)Game.GameSlotTypeEnum.OncePerDay: isValid = diffDate.TotalHours > 24; break; default: isValid = true; break; } } else { isValid = true; } return(isValid); }