public ProgramareDataViewModel GetProgramareDataInceputFinal(DateTime dataI, DateTime dataF) { IEnumerable <Programare> programariL = unitOfWork.ProgramareRepository.Get(); programariL = programariL.Where(p => p.dataOra.Date >= dataI.Date && p.dataOra.Date <= dataF.Date); ProgramareDataViewModel programareDataViewModel = new ProgramareDataViewModel { programari = programariL.ToList(), DateInceput = new SelectList(unitOfWork.ProgramareRepository.selectListData().Distinct().ToList()), DateFinala = new SelectList(unitOfWork.ProgramareRepository.selectListData().Distinct().ToList()) }; return(programareDataViewModel); }
// GET: Programare public async Task <IActionResult> Index(string numeClient, DateTime pdataI, DateTime pdataF) { ProgramareDataViewModel programareDataViewModel = new ProgramareDataViewModel(); var programari = _programareService.GetProgramari(); programareDataViewModel.programari = programari.ToList(); programareDataViewModel = _programareService.GetProgramareDataInceputFinal(pdataI, pdataF); if (pdataF == DateTime.Parse("1/1/0001") && pdataI == DateTime.Parse("1/1/0001")) { programareDataViewModel.programari = programari.ToList(); } if (!String.IsNullOrEmpty(numeClient)) { programari = _programareService.GetProgramareClient(numeClient); programareDataViewModel.programari = programari.ToList(); } return(View(programareDataViewModel)); }