Exemple #1
0
        public async Task <bool> Create(ExamRoomExamPeriod examRoomExamPeriod)
        {
            ExamRoomExamPeriodDAO examRoomExamPeriodDAO = examRegContext.ExamRoomExamPeriod
                                                          .Where(s => (s.ExamRoomId.Equals(examRoomExamPeriod.ExamRoomId) && s.ExamPeriodId.Equals(examRoomExamPeriod.ExamPeriodId)))
                                                          .FirstOrDefault();

            if (examRoomExamPeriodDAO == null)
            {
                examRoomExamPeriodDAO = new ExamRoomExamPeriodDAO()
                {
                    ExamRoomId   = examRoomExamPeriod.ExamRoomId,
                    ExamPeriodId = examRoomExamPeriod.ExamPeriodId
                };

                await examRegContext.ExamRoomExamPeriod.AddAsync(examRoomExamPeriodDAO);
            }
            else
            {
                examRoomExamPeriodDAO.ExamRoomId   = examRoomExamPeriod.ExamRoomId;
                examRoomExamPeriodDAO.ExamPeriodId = examRoomExamPeriod.ExamPeriodId;
            };
            await examRegContext.SaveChangesAsync();

            return(true);
        }
Exemple #2
0
        public async Task <bool> Delete(Guid ExamRoomId, Guid ExamPeriodId)
        {
            ExamRoomExamPeriodDAO ExamRoomExamPeriodDAO = examRegContext.ExamRoomExamPeriod
                                                          .Where(s => (s.ExamRoomId.Equals(ExamRoomId) && s.ExamPeriodId.Equals(ExamPeriodId)))
                                                          .FirstOrDefault();

            examRegContext.ExamRoomExamPeriod.Remove(ExamRoomExamPeriodDAO);
            await examRegContext.SaveChangesAsync();

            return(true);
        }