public void AddTime_Success()
        {
            // Setup
            TimesheetContext db   = new TimesheetContext();
            User             user = db.Users.First();
            int  maxTimeId        = db.Times.Select(t => t.Id).Max();
            Time time             = new Time()
            {
                Date = DateTime.Today, HoursWorked = 5, UserId = user.Id
            };

            // Test action
            TimesheetRepository repository = new TimesheetRepository();

            repository.AddTime(time);

            // Assertions
            Time newTime = db.Times.First(t => t.Id > maxTimeId);

            Assert.IsNotNull(newTime);
            Assert.AreEqual(time.Date, newTime.Date);

            // Cleanup
            db.Times.Remove(newTime);
        }
        //[ValidateAntiForgeryToken]
        public ActionResult AddTime(Time time)
        {
            if (ModelState.IsValid)
            {
                // Save time to DB
                repository.AddTime(time);

                // Send email notification
                // TODO: set this up as an asynchronous process that we don't need to wait for
                var user = repository.GetUser(time.UserId);
                EmailManager.Send(user.Manager.Email, time);
                return(RedirectToAction("Index"));
            }

            return(View(time));
        }