public ActionResult Create() { EmployeeContext empDB = new EmployeeContext(); Employee emp = new Employee(); var emp1 = new Employee() { CheckInTime = DateTime.Now }; empDB.SaveChanges(); return View(emp1);
public ActionResult Edit(int id) { Employee employee = db.Employees.Find(id); if (employee.CheckOutTime == null) { var emp2 = new Employee(); { emp2.CheckOutTime = DateTime.Now; }; return View(emp2); } return View(employee.CheckOutTime); } // // POST: /Employee/Edit/5 [HttpPost] public ActionResult Edit(Employee employee) { Employee em = new Employee(); if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(employee.CheckOutTime=System.DateTime.Today); } // // GET: /Employee/Delete/5 public ActionResult Delete(int id) { Employee employee = db.Employees.Find(id); return View(employee); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)