public ActionResult UpdateAllocationList(string[] Parameters, int SessionId, int ClassId, int SectionId) { string ResultMessage = ""; try { int TotalStudent = 0; objBDC = new SectionAllocationBusiness(); SectionAllocationCustomModel objModel = new SectionAllocationCustomModel(); TotalStudent = objBDC.GetTotalStudentInSection(SessionId, ClassId, SectionId); if (TotalStudent > 30) { ResultMessage = "Only 70 students are allowed in one batch."; } if (Parameters.Length > 0) { int AfterStudentCount = TotalStudent + Parameters.Length; if (AfterStudentCount > 30) { ResultMessage = "Only 30 students are allowed in one section. You have selected " + Parameters.Length + " students. There are already " + TotalStudent + " students in this section."; } else { foreach (string Id in Parameters) { objModel.SessionId = SessionId; objModel.ClassId = ClassId; objModel.SectionId = SectionId; objModel.AdmissionId = Convert.ToInt32(Id); objModel.IsActive = true; objModel.Status = "Attending"; objBDC.SaveSectionAllocationDetails(objModel); } ResultMessage = "Student Allocated in batch Successfully."; } } } catch (Exception ex) { } return(View(ResultMessage)); }
public ActionResult CancelAllocatedStudent(int Id) { if (Id != 0) { objBDC = new SectionAllocationBusiness(); int _Result = objBDC.CancelAllocatedStudentSection(Id); if (_Result == 1) { return(Json(new { IsSuccess = true })); } else { return(Json(new { IsSuccess = false })); } } else { return(Json(new { IsSuccess = false })); } }