Esempio n. 1
0
 public ActionResult Create(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Employees.Add(employee);
         //var currentTime = DateTime.Now;
         //employee.CreatedOn = currentTime;
         //employee.LastUpdatedOn = currentTime;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     CreateEmployeeDropDowns();
     CreateDivisionArray();
     return View(employee);
 }
Esempio n. 2
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         //employee.LastUpdatedOn = DateTime.Now;
         //employee.CreatedOn = employee.CreatedOn;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     CreateEmployeeDropDowns(employee.Manager,employee.DivisionID,employee.BranchID,employee.BuildingID);
     CreateDivisionArray();
     return View(employee);
 }