public ActionResult EmployeeCheckedIn(int id, bool IsEntry) { PoolDataEntitiesConnection ctx = new PoolDataEntitiesConnection(); EmployeeTime checkinTime = new EmployeeTime(); checkinTime.Time = DateTime.Now; checkinTime.Entry = IsEntry; checkinTime.EmployeeId = id; ctx.EmployeeTimes.Add(checkinTime); ctx.SaveChanges(); TempData["success"] = "Employee checked " + (IsEntry ? "In" : "Out"); return RedirectToAction("Index", "Search"); }
public ActionResult Create(EmployeeTime employeetime) { if (ModelState.IsValid) { db.EmployeeTimes.Add(employeetime); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", employeetime.EmployeeId); return View(employeetime); }