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