public ActionResult CreateAdjustment(EmployeeAdjustmentCreateViewModel viewModel) { var employeeAdjustment = viewModel.MapItem <EmployeeAdjustment>(); _employeeAdjustmentRepository.Add(employeeAdjustment); _unitOfWork.Commit(); return(RedirectToAction("Adjustment")); }
public ActionResult EditAdjustment(EmployeeAdjustmentCreateViewModel viewModel) { var adjustment = _employeeAdjustmentRepository.GetById(viewModel.EmployeeAdjustmentId); _employeeAdjustmentRepository.Update(adjustment); adjustment.InjectFrom(viewModel); _unitOfWork.Commit(); return(RedirectToAction("Adjustment")); }
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)); }