public ActionResult AddStudentSiblingDetails(Student_Sibling_Detail stuSiblingDetail)
        {
            stuSiblingDetail.Created_On    = DateTime.Now;
            stuSiblingDetail.Academic_Year = GetAcademicYear();

            stuSiblingDetail.Is_Active = true;
            List <Student_SiblingList_ViewModel> addedStudentSiblingDetails = new List <Student_SiblingList_ViewModel>();

            addedStudentSiblingDetails = GetStudentSiblingDetails(stuSiblingDetail);

            return(Json(new { items = addedStudentSiblingDetails }, JsonRequestBehavior.AllowGet));
        }
        public List <Student_SiblingList_ViewModel> GetStudentSiblingDetails(Student_Sibling_Detail stuSiblingDetail)
        {
            long nYear       = GetAcademicYear();
            long nStudent_Id = Convert.ToInt64(TempData.Peek("Student_Id"));

            stuSiblingDetail.Student_Id = nStudent_Id;
            List <Student_SiblingList_ViewModel> addedStudentSiblingDetails = new List <Student_SiblingList_ViewModel>();

            try
            {
                using (var dbcontext = new SchoolERPDBContext())
                {
                    if (stuSiblingDetail != null)
                    {
                        dbcontext.Student_Sibling_Detail.Add(stuSiblingDetail);
                        dbcontext.SaveChanges();
                    }
                }

                using (var dbcontext = new SchoolERPDBContext())
                {
                    addedStudentSiblingDetails = (from stu in dbcontext.Student
                                                  join studentSiblingDetail in dbcontext.Student_Sibling_Detail on stu.Student_Id equals studentSiblingDetail.Sibling_Student_Id
                                                  join cls in dbcontext.Class on stu.Class_Id equals cls.Id
                                                  join sec in dbcontext.Section on stu.Section_Id equals sec.Id
                                                  where studentSiblingDetail.Student_Id == nStudent_Id && studentSiblingDetail.Academic_Year == nYear && studentSiblingDetail.Is_Deleted == null || studentSiblingDetail.Is_Deleted == false
                                                  select new Student_SiblingList_ViewModel
                    {
                        Sibling_Detail_Id = studentSiblingDetail.Sibling_Detail_Id,
                        Class = cls.Name,
                        Section = sec.Name,
                        Student_Name = stu.First_Name + "  " + stu.Last_Name,
                        Roll_No = stu.Roll_No,
                        Updated_On = studentSiblingDetail.Updated_On,
                        Student_Id = studentSiblingDetail.Student_Id,
                        Sibling_Relation = studentSiblingDetail.Sibling_Relation
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
            }

            return(addedStudentSiblingDetails);
        }