public async Task <bool> Create(ExamPeriod examPeriod) { ExamPeriodDAO examPeriodDAO = new ExamPeriodDAO() { Id = examPeriod.Id, ExamDate = examPeriod.ExamDate, StartHour = examPeriod.StartHour, FinishHour = examPeriod.FinishHour, TermId = examPeriod.TermId, ExamProgramId = examPeriod.ExamProgramId }; await examRegContext.ExamPeriod.AddAsync(examPeriodDAO); await examRegContext.SaveChangesAsync(); return(true); }
public async Task <bool> Delete(Guid Id) { await examRegContext.ExamRegister .Where(er => er.ExamPeriodId.Equals(Id)) .DeleteFromQueryAsync(); await examRegContext.ExamRoomExamPeriod .Where(s => s.ExamPeriodId.Equals(Id)) .DeleteFromQueryAsync(); ExamPeriodDAO examPeriodDAO = examRegContext.ExamPeriod .Where(e => e.Id.Equals(Id)) .FirstOrDefault(); examRegContext.ExamPeriod.Remove(examPeriodDAO); await examRegContext.SaveChangesAsync(); return(true); }