예제 #1
0
        // GET: Dependent/Create
        public ActionResult Create(long employeeId)
        {
            Dependent model = new Dependent()
            {
                EmployeeId = employeeId
            };

            return View(model);
        }
예제 #2
0
        public ActionResult Edit(long id, Dependent dependent)
        {
            try
            {
                _employeeRepo.SaveDependent(dependent);

                return RedirectToAction("Details", "Employee", new { id = dependent.EmployeeId });
            }
            catch
            {
                return View(dependent);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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;
            }
        }