Exemplo n.º 1
0
        public async static Task <ScheduleViewModel> ReBuildForEditAsync(
            ScheduleViewModel model,
            IScheduleSevice services)
        {
            model.ProjectOptions = await services.GetShdeduleProjectOptions();

            model.ScheduleOptions = services.GetScheduleOptions();

            return(model);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 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>()
     });
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 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)
     });
 }