public JsonResult GetStudentsByClassSection(string ClassId, string SectionId) { ResponseResult responseResult = new ResponseResult(); List <GetStudentInfo_SP_Result> studentList = new List <GetStudentInfo_SP_Result>(); SubjectByClassSectionVM sObj = new SubjectByClassSectionVM() { ClassId = Convert.ToInt32(ClassId), SectionId = Convert.ToInt32(SectionId) }; try { var res = _apiRequest.HttpPostRequest(sObj, "api/Student/StudentsInfoListByClassSection"); string apiResponse = res.ToString(); responseResult = JsonConvert.DeserializeObject <ResponseResult>(apiResponse); if (responseResult.MessageCode == "Y") { studentList = JsonConvert.DeserializeObject <List <GetStudentInfo_SP_Result> >(responseResult.Content.ToString()); } //else if (responseResult.MessageCode == "N") //{ // //teachers = JsonConvert.DeserializeObject<bool>(responseResult.Content.ToString()); //} } catch (Exception ex) { TempData["msgAlert"] = "N"; TempData["msgAlertDetails"] = ex.Message.ToString(); } return(Json(studentList, JsonRequestBehavior.AllowGet)); }
//public IEnumerable<object> GetSubjectListByClassSectionForDropDown(int classId, int sectionId) //{ // var subjectist = GetSubjectListByClassSection(classId, sectionId).Select(a => new // { // a.SubjectId, // a.SubjectName // }); // return subjectist; //} public JsonResult GetSubjectListByClassSection(int ClassId, int SectionId) { ResponseResult responseResult = new ResponseResult(); List <SubjectVM> subjectList = new List <SubjectVM>(); SubjectByClassSectionVM subjectVM = new SubjectByClassSectionVM() { ClassId = ClassId, SectionId = SectionId }; try { var res = _apiRequest.HttpPostRequest(subjectVM, "api/Subject/SubjectList"); string apiResponse = res.ToString(); responseResult = JsonConvert.DeserializeObject <ResponseResult>(apiResponse); if (responseResult.MessageCode == "Y") { subjectList = JsonConvert.DeserializeObject <List <SubjectVM> >(responseResult.Content.ToString()); //TempData["msgAlert"] = "Y"; //TempData["msgAlertDetails"] = responseResult.SystemMessage; } } catch (Exception ex) { TempData["msgAlert"] = "N"; TempData["msgAlertDetails"] = ex.Message.ToString(); } return(Json(subjectList, JsonRequestBehavior.AllowGet)); }
public ResponseResult GetStudentsInfoListByClassSection(SubjectByClassSectionVM subjectByClassSectionVM) { ResponseResult responseResult = new ResponseResult(); try { responseResult.Content = _dbContext.GetStudentInfo_SP(subjectByClassSectionVM.ClassId, subjectByClassSectionVM.SectionId); responseResult.MessageCode = MessageCode.Y.ToString(); responseResult.SystemMessage = "Data Found!"; } catch (Exception ex) { responseResult.Content = null; responseResult.MessageCode = MessageCode.Y.ToString(); responseResult.SystemMessage = ex.Message; } return(responseResult); }
public ActionResult AssignUserWithStudent(int ClassId, int SectionId) { ResponseResult responseResult = new ResponseResult(); List <vm_GetAllStudentInfo2> studentList = new List <vm_GetAllStudentInfo2>(); SubjectByClassSectionVM subjectByClassSectionVM = new SubjectByClassSectionVM() { ClassId = ClassId, SectionId = SectionId }; try { var res = _apiRequest.HttpPostRequest(subjectByClassSectionVM, "api/Student/StudentsInfoListByClassSection"); string apiResponse = res.ToString(); responseResult = JsonConvert.DeserializeObject <ResponseResult>(apiResponse); if (responseResult.MessageCode == "Y") { studentList = JsonConvert.DeserializeObject <List <vm_GetAllStudentInfo2> >(responseResult.Content.ToString()); if (studentList.Count < 1) { TempData["msgAlert"] = "Y"; TempData["msgAlertDetails"] = "No Student Found!"; } } } catch (Exception ex) { TempData["msgAlert"] = "N"; TempData["msgAlertDetails"] = ex.Message.ToString(); } ViewData["ClassList"] = new SelectList(GetClassListForDropDown(), "ClassId", "ClassWithShift"); ViewData["SectionList"] = new SelectList(GetSectionListForDropDown(), "SectionId", "SectionName"); return(View(studentList)); }
public ResponseResult GetSubjectListByClassSection(SubjectByClassSectionVM subjectByClassSectionVM) { ResponseResult responseResult = new ResponseResult(); try { var subjectList = _dbContext.Subjects .Where(a => a.ClassId == subjectByClassSectionVM.ClassId && a.SectionId == subjectByClassSectionVM.SectionId) .Select(a => new { a.SubjectId, a.SubjectName, a.MaskingSubjectId }); if (subjectList != null) { responseResult.Content = subjectList; responseResult.MessageCode = MessageCode.Y.ToString(); responseResult.SystemMessage = "Data found!"; } else { responseResult.Content = null; responseResult.MessageCode = MessageCode.N.ToString(); responseResult.SystemMessage = "Data not found!"; } } catch (Exception ex) { responseResult.Content = null; responseResult.MessageCode = MessageCode.N.ToString(); responseResult.SystemMessage = ex.Message; } return(responseResult); }