public async static Task <ScheduleViewModel> ReBuildForEditAsync( ScheduleViewModel model, IScheduleSevice services) { model.ProjectOptions = await services.GetShdeduleProjectOptions(); model.ScheduleOptions = services.GetScheduleOptions(); return(model); }
public async static Task <IEnumerable <ScheduleViewModel> > ReBuildCollectionForEditAsync( IEnumerable <ScheduleViewModel> models, IScheduleSevice services) { var projectOptions = await services.GetShdeduleProjectOptions(); var scheduleOptions = services.GetScheduleOptions(); models.ToList().ForEach(x => { x.ProjectOptions = projectOptions; x.ScheduleOptions = scheduleOptions; }); return(models); }
public async static Task <ScheduleViewModel> CreateForEditAsync( Schedule schedule, IScheduleSevice services, IMapper mapper) { var model = mapper.Map <Schedule, ScheduleViewModel>(schedule); model.ProjectOptions = await services.GetShdeduleProjectOptions(); model.ScheduleOptions = services.GetScheduleOptions(); return(model); }
public async static Task <IEnumerable <ScheduleViewModel> > CreateCollectionForEditAsync( IEnumerable <Schedule> schedules, IScheduleSevice services, IMapper mapper) { var scheduleModels = mapper.Map <IEnumerable <Schedule>, IEnumerable <ScheduleViewModel> >(schedules); var projectOptions = await services.GetShdeduleProjectOptions(); var scheduleOptions = services.GetScheduleOptions(); scheduleModels.ToList().ForEach(x => { x.ProjectOptions = projectOptions; x.ScheduleOptions = scheduleOptions; }); return(scheduleModels); }
public async static Task <SearchViewModel> Create( IScheduleSevice services, IMapper mapper) { return(new SearchViewModel() { // Giving some start values for the SearchModel dates. To = DateTime.Now, From = DateTime.Now.AddDays(-7), ProjectOptions = await services.GetShdeduleProjectOptions(), ScheduleOptions = services.GetScheduleOptions(), EmployeeOptions = await services.GetShdeduleEmployeeOptions(), Employees = new HashSet <EmployeeViewModel>() }); }
public async static Task <SearchViewModel> ReBuild( SearchViewModel model, IScheduleSevice services, IMapper mapper) { model.To = DateTime.Now; model.From = model.To.AddDays(-7); model.ProjectOptions = await services.GetShdeduleProjectOptions(); model.ScheduleOptions = services.GetScheduleOptions(); model.EmployeeOptions = await services.GetShdeduleEmployeeOptions(); model.Employees = new HashSet <EmployeeViewModel>(); return(model); }
public async static Task <SearchViewModel> Create( IScheduleSevice services, IMapper mapper, IEnumerable <EmployeeViewModel> employees) { return(new SearchViewModel() { // Giving some start values for the SearchModel dates. To = DateTime.Now, From = DateTime.Now.AddDays(-7), ProjectOptions = await services.GetShdeduleProjectOptions(), ScheduleOptions = services.GetScheduleOptions(), EmployeeOptions = await services.GetShdeduleEmployeeOptions(), Employees = employees.Where(e => e.Schedules != null && e.Schedules.Count() > 0) }); }