Example #1
0
 public static IndexViewModel Create(IPayrollService services, string message = null)
 {
     return(new IndexViewModel()
     {
         Message = message ?? string.Empty,
         PeriodOptions = services.GetPeriodsOptions()
     });
 }
        public async static Task <ReviewPaychecksViewModel> ReBuildAsync(ReviewPaychecksViewModel model, IPayrollService services)
        {
            model.EmployeeOptions = await services.GetShdeduleEmployeeOptions();

            model.PeriodOptions = services.GetPeriodsOptions();

            return(model);
        }
 public async static Task <ReviewPaychecksViewModel> CreateAsync(IPayrollService services)
 {
     return(new ReviewPaychecksViewModel()
     {
         EmployeeOptions = await services.GetShdeduleEmployeeOptions(),
         PeriodOptions = services.GetPeriodsOptions()
     });
 }
        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);
        }