public ActionResult Edit(Employee employee) {
     if (!ModelState.IsValid) {
         ViewBag.Status = GetStatusList(_repo.ListTypes());
         return View(employee);
     }
     _repo.EditEmployee(employee); 
     return RedirectToAction("Index");
 }
 private SelectList GetStatusList(List<StatusType> status, bool isFilter = false, Employee employee = null) {
     if (employee == null && !isFilter)
         return new SelectList(status, "Id", "StatusName");
     if (employee == null) {
         status.Insert(0, new StatusType { Id = 0, StatusName = NameAll });
         return new SelectList(status, "Id", "StatusName");
     }
     return new SelectList(status, "Id", "StatusName", employee.StatusTypeId);   
     }
 public void EditEmployee(Employee employee) {
     db.Entry(employee).State = EntityState.Modified;
     db.SaveChanges();
 }
 public void Save(Employee employee) {
     db.Employees.Add(employee);
     db.SaveChanges();
 }