示例#1
0
        public ActionResult CreateAdjustment(EmployeeAdjustmentCreateViewModel viewModel)
        {
            var employeeAdjustment = viewModel.MapItem <EmployeeAdjustment>();

            _employeeAdjustmentRepository.Add(employeeAdjustment);
            _unitOfWork.Commit();

            return(RedirectToAction("Adjustment"));
        }
示例#2
0
        public ActionResult EditAdjustment(EmployeeAdjustmentCreateViewModel viewModel)
        {
            var adjustment = _employeeAdjustmentRepository.GetById(viewModel.EmployeeAdjustmentId);

            _employeeAdjustmentRepository.Update(adjustment);

            adjustment.InjectFrom(viewModel);
            _unitOfWork.Commit();

            return(RedirectToAction("Adjustment"));
        }
示例#3
0
        public ActionResult CreateAdjustment(string date, int id = 0)
        {
            var dates     = date.Split('-');
            var viewModel = new EmployeeAdjustmentCreateViewModel
            {
                Adjustments = _adjustmentRepository.GetAllActive().ToList(),
                EmployeeId  = id,
                Employee    = id > 0 ? _employeeRepository.GetById(id) : null,
                StartDate   = dates[0].DeserializeDate().ToShortDateString(),
                EndDate     = dates[1].DeserializeDate().ToShortDateString(),
            };

            return(View(viewModel));
        }