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); }
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); }