Example #1
0
        public ActionResult Edit(long id, Employee input)
        {
            try
            {
                _employeeRepo.SaveEmployee(input);

                return RedirectToAction("Details", new {id = id});
            }
            catch
            {
                return View();
            }
        }
Example #2
0
        public ActionResult Create(Employee employee)
        {
            try
            {
                employee.ClientId = GetCurrentUserContext().ClientId;
                _employeeRepo.SaveEmployee(employee);

                return RedirectToAction("Details", new { id = employee.Id } );
            }
            catch
            {
                return View(employee);
            }
        }
Example #3
0
        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;
            }
        }