public async Task <IActionResult> EmployeesScheduler(EmployeesShcedulerViewModel model) { if (!ModelState.IsValid) { return(View(await EmployeesShcedulerViewModel.ReBuildAsync(model, this.ScheduleSevice, this.Mapper))); } var shcedules = new List <Schedule>(); model.Employees.ToList().ForEach(e => shcedules.Add(Schedule.Create( DateTime.Now, e.NewSchedule.ScheduleOption, e.NewSchedule.EmployeeId, e.NewSchedule.ProjectId, e.NewSchedule.WorkHours, e.NewSchedule.ExtraWorkHours))); this.SchedulerWorkData.Schedules.AddRange(shcedules); await this.SchedulerWorkData.CompleteAsync(); return(View(await EmployeesShcedulerViewModel.CreateAsync(this.ScheduleSevice, this.Mapper))); }
public async Task <IActionResult> EmployeesScheduler() { return(View(await EmployeesShcedulerViewModel.CreateAsync(this.ScheduleSevice, this.Mapper))); }