示例#1
0
        public async static Task <ReviewPaychecksViewModel> ReBuildAsync(ReviewPaychecksViewModel model, IPayrollService services)
        {
            model.EmployeeOptions = await services.GetShdeduleEmployeeOptions();

            model.PeriodOptions = services.GetPeriodsOptions();

            return(model);
        }
示例#2
0
        public async static Task <ReviewPaychecksViewModel> CreateAsync(
            ReviewPaychecksViewModel model,
            DateTime from,
            DateTime to,
            IPayrollService services,
            IMapper mapper)
        {
            var employees = await services.GetEmployees();

            var employeeModels = mapper.Map <IEnumerable <Employee>, IEnumerable <EmployeeViewModel> >(employees);

            employeeModels.ToList().ForEach(e =>
                                            e.Paychecks = e.Paychecks.Where(p => from <= p.Period.From && to >= p.Period.To).OrderBy(p => p.Period.From));

            model.EmployeeOptions = await services.GetShdeduleEmployeeOptions();

            model.PeriodOptions = services.GetPeriodsOptions();
            model.Employees     = employeeModels;

            return(model);
        }