Example #1
0
        public List<TimeEntry> GetTimeEntries(DateTime date, User user)
        {
            var dateUtcStart = user.ConvertLocalTimeToUtc(date);
            var dateUtcEnd = dateUtcStart.AddDays(1);

            return _context.TimeEntries
                .Include("ProjectTask")
                .Include("ProjectTask.Project")
                .Where(te => te.UserId == user.UserId &&
                    te.TimeInUtc >= dateUtcStart && te.TimeInUtc < dateUtcEnd)
                .OrderBy(te => te.TimeInUtc)
                .ToList();
        }
 public CurrentUser(IRepository repository)
 {
     _repository = repository;
     // TODO replace with reference to the logged in user
     _currentUser = _repository.GetUser(1);
 }