Beispiel #1
0
        public async Task <IEnumerable <Room> > GetRooms()
        {
            //return await _repo.GetT();
            var rooms = await _repo.GetT();

            foreach (var room in rooms)
            {
                room.ExamCenter = await _centerRepo.GetTById(room.CenterId);

                room.ExamCenter.Rooms = null;
            }
            return(rooms);
        }
Beispiel #2
0
        public async Task <ActionResult> GetSubject([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var subject = await _repo.GetTById(id);

            if (subject == null)
            {
                return(NotFound());
            }
            return(Ok(subject));
        }
        public async Task <ActionResult> GetCenter([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var center = await _repo.GetTById(id);

            if (center == null)
            {
                return(NotFound());
            }
            return(Ok(center));
        }
Beispiel #4
0
        public async Task <ActionResult <Notice> > GetNotice([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var notice = await _repo.GetTById(id);

            if (notice == null)
            {
                return(NotFound());
            }
            return(notice);
        }
Beispiel #5
0
        public async Task <IEnumerable <Exam> > GetExams()
        {
            List <Exam> examsToReturn = new List <Exam>();
            var         exams         = await _repo.GetT();

            foreach (var exam in exams)
            {
                var session = await _sessionRepo.GetTById(exam.SessionId);

                session.Exams = null;
                exam.Session  = session;
                examsToReturn.Add(exam);
            }
            return(examsToReturn);
        }
Beispiel #6
0
        public async Task <ActionResult> DeleteResult([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var standard = await _repo.GetTById(id);

            if (standard == null)
            {
                return(NotFound());
            }
            _repo.Delete(standard);
            await _repo.SaveAsync(standard);

            return(Ok(standard));
        }
Beispiel #7
0
        public async Task <ActionResult> GetRoom([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var room = await _repo.GetTById(id);

            if (room == null)
            {
                return(NotFound());
            }
            room.ExamCenter = await _centerRepo.GetTById(room.CenterId);

            room.ExamCenter.Rooms = null;
            return(Ok(room));
        }
Beispiel #8
0
        public async Task <ActionResult> GetExam([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var exam = await _repo.GetTById(id);

            if (exam == null)
            {
                return(NotFound());
            }
            var session = await _sessionRepo.GetTById(exam.SessionId);

            session.Exams = null;
            exam.Session  = session;
            return(Ok(exam));
        }