public async Task <IActionResult> Search(SearchViewModel model) { if (!ModelState.IsValid) { return(View(await SearchViewModel.ReBuild(model, this.ScheduleSevice, this.Mapper))); } if (model.From > model.To) { ModelState.AddModelError(string.Empty, Constants.ValidationMessages.IncorectDate); return(View(await SearchViewModel.ReBuild(model, this.ScheduleSevice, this.Mapper))); } var employees = await this.ScheduleSevice.GetEmployees(); var employeesResult = this.ScheduleSevice.FindEmployeeSchedules( employees, model.From, model.To, model.EmployeeId, model.ProjectId, model.ScheduleOption); return(View(await SearchViewModel.Create(this.ScheduleSevice, this.Mapper, employeesResult))); }
public async Task <IActionResult> Search() { return(View(await SearchViewModel.Create(this.ScheduleSevice, this.Mapper))); }