public ActionResult Index()
        {
            var vm = new ClockinPageViewModel
            {
                EmployeeName = "EmployeeName",
                Password = "******"
            };

            return View(vm);
        }
        public ActionResult Index(ClockinPageViewModel viewModel)
        {
            if (string.IsNullOrEmpty(viewModel.EmployeeName)
                || string.IsNullOrEmpty(viewModel.Password))
            {
                viewModel.ErrorMessage = "Please provide your username and password";
                return View(viewModel);
            }

            // TODO add in catch to verify employee name and user companies match
            //if (!_context.hasUser(viewModel.EmployeeName))
            //{
            //    viewModel.ErrorMessage = "Employee not found.";
            //    return View(viewModel);
            //}
            Employee e = _context.getEmployee(viewModel.EmployeeName);
            if (e == null)
            {
                viewModel.ErrorMessage = "Employee not found.";
                return View(viewModel);
            }
            if (!e.Password.Equals(viewModel.Password))
            {
                viewModel.ErrorMessage = "Wrong pass.";
                return View(viewModel);
            }

            var n = string.Format("{0:MM/dd/yy HH:mm:ss tt}", DateTime.Now);
            Trace.WriteLine("will save " + e.Name + " with pass " + e.Password + "at " + n);

            var a = n.Split(' ');
            var t = a[1].Split(':');
            Trace.WriteLine("a0=" + a[0] + " a1=" + a[1]);
            Trace.WriteLine("t0=" + t[0] + " t1=" + t[1] + " t2=" + t[2]);
            var date = a[0];
            var datea = date.Split('/');
            var month = datea[0];
            var day = datea[1];
            var year = datea[2];
            var ampm = "";
            Trace.WriteLine("day=" + datea[1] + " month=" + datea[0] + " year=" + datea[2]);
            var hour = t[0];
            if (Convert.ToInt32(hour) < 13)
            {
                ampm = "AM";
            }
            else
            {
                ampm = "PM";

            }
            Trace.WriteLine("ampm=" + ampm);
            var min = t[1];
            var isatwork_afterlog = (!e.AtWork).ToString();

            //TODO save right organization
            var log = new ClockLog
            {
                EmployeeName = e.Name,
                Organization = "work",
                Hour = hour,
                Min = min,
                Day = day,
                Month = month,
                Year = year,
                AMPM = ampm,
                InOut = isatwork_afterlog

            };

            var inout = "";
            inout = isatwork_afterlog.Equals("True") ? "In" : "Out";
            if (inout.Equals("True"))
            {
                e.AtWork = false;
            }
            else
            {
                e.AtWork = true;
            }
            viewModel.ErrorMessage = e.Name + " you were logged " + inout;
            _context.ClockLogs.Add(log);
            _context.SaveChanges();

            return View(viewModel);
        }