public StatusResponse GetStatus(DateTime fullDate, ISession session, IAuthSession authSession) { var date = fullDate.Date; var trackedData = session[date.ToString()] as TrackedData; if (trackedData == null) trackedData = new TrackedData { Goal = 300, Total = 0 }; var message = authSession.DisplayName; return new StatusResponse { Message = message, Total = trackedData.Total, Goal = trackedData.Goal }; }
public void AddEntry(int amount, DateTime time, ISession session) { var date = time.Date; var trackedData = (TrackedData)session[date.ToString()]; if (trackedData == null) trackedData = new TrackedData { Goal = 300 }; trackedData.Total += amount; session[date.ToString()] = trackedData; }