i created a simple jackpot game. I completed the game, but my current problem is replenishing the coins everyday. I'm giving 10 coins per day, and the update should be at 9am. The problem is i don't know when to store the firstPlayedDate it. This is what I have been trying so far.
public DateTime firstPlayedDate
{
get
{
CoinTracker firstPlayedEntry = _db.CoinTrackers.Where(u => u.FbId == fbId).OrderByDescending(u => u.CoinTimer).FirstOrDefault();
return firstPlayedEntry == null ? new DateTime() : firstPlayedEntry.CoinTimer;
}
}
public int AvailableDailyCoins
{
get
{
return (DateTime.UtcNow.Date - firstPlayedDate.Date).Days > 0 ? 10 : 0;
}
}
One way i thought of was, everytime the player has 10 coins, i store the firstPlayedDate. Any other ideas??