Example #1
0
        public async Task <bool> Create(ExamProgram examProgram)
        {
            ExamProgramDAO examProgramDAO = new ExamProgramDAO()
            {
                Id         = examProgram.Id,
                Name       = examProgram.Name,
                SemesterId = examProgram.SemesterId,
                IsCurrent  = false
            };
            await examRegContext.ExamProgram.AddAsync(examProgramDAO);

            await examRegContext.SaveChangesAsync();

            return(true);
        }
Example #2
0
        public async Task <bool> Delete(Guid Id)
        {
            await examRegContext.ExamRegister.Where(t => t.Exam.ExamPeriod.ExamProgramId.Equals(Id)).DeleteFromQueryAsync();

            await examRegContext.ExamRoomExamPeriod.Where(t => t.ExamPeriod.ExamProgramId.Equals(Id)).DeleteFromQueryAsync();

            await examRegContext.ExamPeriod
            .Where(t => t.ExamProgramId.Equals(Id))
            .DeleteFromQueryAsync();

            ExamProgramDAO examProgramDAO = examRegContext.ExamProgram
                                            .Where(e => e.Id.Equals(Id))
                                            .FirstOrDefault();

            examRegContext.ExamProgram.Remove(examProgramDAO);
            await examRegContext.SaveChangesAsync();

            return(true);
        }