public ActionResult Edit(long id, Employee input) { try { _employeeRepo.SaveEmployee(input); return RedirectToAction("Details", new {id = id}); } catch { return View(); } }
public ActionResult Create(Employee employee) { try { employee.ClientId = GetCurrentUserContext().ClientId; _employeeRepo.SaveEmployee(employee); return RedirectToAction("Details", new { id = employee.Id } ); } catch { return View(employee); } }
public Employee SaveEmployee(Employee employee) { using (Database db = DbFactory.PayDbFactory.GetDatabase()) { DateTime now = DateTime.UtcNow; if (employee.Id == 0) { employee.Created = now; //employee.CreatedBy = userId; } employee.LastModified = now; //employee.LastModifiedBy = userId; db.Save<Employee>(employee); return employee; } }