public async Task <IActionResult> GetByTeacher(SearchPeriodByTeacherModel model) { var service = new PeriodRepository(connString); var result = await service.GetAllPeriodByTeacher(model.TeacherId, model.StartDate, model.EndDate); var response = new GenericResponse <List <Period> >() { IsSuccess = true, Message = "Data fetched successfully.", ResponseCode = 200, Result = result }; return(Ok(response)); }
public async Task <IActionResult> GetByTeacherNext(int id) { var service = new PeriodRepository(connString); var result = await service.GetAllPeriodByTeacher(id, DateTime.Today, DateTime.Today.AddDays(1)); var res = result.Where(a => a.StartDateTime > DateTime.Now).OrderBy(a => a.StartDateTime).FirstOrDefault(); var response = new GenericResponse <Period>() { IsSuccess = true, Message = "Data fetched successfully.", ResponseCode = 200, Result = res }; return(Ok(response)); }