public ActionResult EmployeeEntry(TimeEntryEmployeeVM entry)
        {
            var shift = db.Shifts.Find(entry.ShiftId);
            var employee = db.Employees.Find(entry.EmployeeId);

            //Look for an existing time entry for this day and shift for this employee.
            var timeEntry = employee.TimeEntries.FirstOrDefault(te => te.Day.Date == entry.Date.Date && te.Shift == shift);

            if (timeEntry == null) //there isn't an existing time entry, so create a new one.
            {
                timeEntry = new TimeEntry
                {
                    Employee = employee,
                    Shift = shift,
                    Day = entry.Date.Date
                };

                employee.TimeEntries.Add(timeEntry);
            }

            timeEntry.BillableHours = 0;
            timeEntry.DayStatus = DayStatus.Present;
            timeEntry.CheckInStatus = entry.CheckInTimeStatus;
            timeEntry.CheckOutStatus = entry.CheckOutTimeStatus;

            db.SaveChanges();

            return RedirectToAction("Index", new {shiftid = entry.ShiftId, teamid = entry.TeamId});
        }
 public ActionResult EmployeeEntry(int employeeid, int shiftid, DateTime date)
 {
     var shift = db.Shifts.Find(shiftid);
     //var team = db.Teams.Find(teamId);
     var employee = db.Employees.Find(employeeid);
     var model = new TimeEntryEmployeeVM()
     {
         Date = date.Date,
         ShiftName = shift.Name,
         ShiftId = shift.Id,
         TeamName = employee.MemberOf.Name,
         TeamId = employee.MemberOf.Id,
         EmployeeName = $"{employee.FirstName} {employee.LastName}",
         EmployeeId = employee.Id,
     };
     return View(model);
 }