public async Task <SharedLookUpResponse> AddExamPaperAsync(AddExam addExamPaper, int instituteId) { if (!await iMSDbContext.ExamPapers.AnyAsync(x => x.InstituteId == instituteId && x.MappingId == addExamPaper.MappingId && x.PublisherName.ToLowerInvariant() == addExamPaper.PublisherName.ToLowerInvariant())) { var examPaper = new ExamPaper() { InstituteId = instituteId, PublisherName = addExamPaper.PublisherName, Pages = addExamPaper.Pages, Description = addExamPaper.Description, MappingId = addExamPaper.MappingId, AcademicYearId = addExamPaper.AcademicYearId }; iMSDbContext.ExamPapers.Add(examPaper); await iMSDbContext.SaveChangesAsync(); return(new SharedLookUpResponse() { HasError = false, Message = "Examination Paper added successfully" }); } else { return(new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Examination Paper with same info is already existed" }); } }
public async Task <IActionResult> AddGroupAsync([FromBody] AddExam addGroupAc) { if (string.IsNullOrEmpty(addGroupAc.PublisherName.Trim())) { return(Ok(new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Name, Message = "Publisher name can't be null or empty" })); } else if (addGroupAc.MappingId == null) { return(Ok(new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Name, Message = "Subject can't be null or empty" })); } else { return(Ok(await examManagementRepository.AddExamPaperAsync(addGroupAc, await GetUserCurrentSelectedInstituteIdAsync()))); } }
static void Main(string[] args) { Utility.InitDb(); AddRoom.AddRooms(); AddDoctor.AddDoctors(); AddPatient.AddPatients(); AddDisease.AddDiseases(); AddExam.ImportExams(); AddRehabilitation.ImportRehabilitation(); AddSurgery.ImportSurgery(); }
// Add exam private void MBtnAddExam_Click(object sender, EventArgs e) { if (!AddValidatorList.All(a => a.IsValid)) { var InvalidValidatingControl = AddValidatorList.First(f => !f.IsValid); InvalidValidatingControl.ControlToValidate.Focus(); return; } var examAdded = new DoAnLTUDQL1.Exam { ExamId = "", ExamName = mTxtAddExamName.Text, IsPacticeExam = false }; if (ExamDetailsAdded == null) { ExamDetailsAdded = new List <ExamDetail>(); } AddExam?.Invoke(examAdded, null); }