示例#1
0
        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));
        }
示例#2
0
        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));
        }