public ActionResult Create([Bind(Include="EmployeeID,FirstName,LastName,JobTitle,Supervisor,ContractLabor,WageRateRT,WageRateOT,HomePhone,CellPhone,Address,EmailAddress,Notes")] EmployeeViewModel employeeViewModel)
        {
            if (ModelState.IsValid)
            {
                // save data into the employee table based on the information in the EmployeeViewModel
                Employee employee = new Employee();
                employee.EmployeeID = employeeViewModel.EmployeeID;
                employee.FirstName = employeeViewModel.FirstName;
                employee.LastName = employeeViewModel.LastName;
                employee.JobTitle = employeeViewModel.JobTitle;
                employee.Supervisor = employeeViewModel.Supervisor;
                employee.ContractLabor = employeeViewModel.ContractLabor;
                employee.HomePhone = employeeViewModel.HomePhone;
                employee.CellPhone = employeeViewModel.CellPhone;
                employee.Address = employeeViewModel.Address;
                employee.EmailAddress = employeeViewModel.EmailAddress;
                employee.Notes = employeeViewModel.Notes;

                db.Employees.Add(employee);
                db.SaveChanges();

                int employeeCount = db.Employees.ToList().Count();
                int EmployeeId = db.Employees.ToList()[employeeCount - 1].EmployeeID;
                WageHistory wageHistory = new WageHistory();
                wageHistory.EmployeeID = EmployeeId;
                wageHistory.WageOT = employeeViewModel.WageRateOT;
                wageHistory.WageRT = employeeViewModel.WageRateRT;
                wageHistory.IsCurrent = true;
                wageHistory.DateStart = DateTime.Now.Date;

                db.WageHistories.Add(wageHistory);
                db.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(employeeViewModel);
        }
        public ContentResult UpdateWageHistoryData(WageHistory wageHistory)
        {
            if (ModelState.IsValid)
            {
                db.Entry(wageHistory).State = EntityState.Modified;
                db.SaveChanges();
            }
            else
            {
                string error = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError err in modelState.Errors)
                    {
                        error = error + " \n" + err.ErrorMessage;
                    }
                }
                return Content("", "application/json");
            }

            var wageHistories = db.WageHistories;
            var wageHistoryData = (from wh in wageHistories
                                   where wh.WageHistoryID == wageHistory.WageHistoryID
                                   select new
                                   {
                                       wh.WageHistoryID,
                                       wh.WageRT,
                                       wh.WageOT,
                                       DateStart = wh.DateStart == null ? null : SqlFunctions.DateName("mm", wh.DateStart) + " " + SqlFunctions.DateName("day", wh.DateStart) + ", " + SqlFunctions.DateName("year", wh.DateStart),
                                       DateEnd = wh.DateEnd == null ? null : SqlFunctions.DateName("mm", wh.DateEnd) + " " + SqlFunctions.DateName("day", wh.DateEnd) + ", " + SqlFunctions.DateName("year", wh.DateEnd),
                                       wh.IsCurrent
                                   }).SingleOrDefault();

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            string output = jsonSerializer.Serialize(wageHistoryData);
            return Content(output, "application/json");
        }
        public ContentResult DeleteWageHistoryData(WageHistory wageHistory)
        {
            var wageHistoryData = db.WageHistories;
            WageHistory removeWageHistory = db.WageHistories.Find(wageHistory.WageHistoryID);

            if (ModelState.IsValid)
            {
                db.WageHistories.Remove(removeWageHistory);
                db.SaveChanges();
            }
            else
            {
                string error = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError err in modelState.Errors)
                    {
                        error = error + " \n" + err.ErrorMessage;
                    }
                }
                return Content("", "application/json");
            }

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            string output = jsonSerializer.Serialize(removeWageHistory);
            return Content(output, "application/json");
        }