コード例 #1
0
        public ActionResult EditMultiple(int id)
        {
            var oStudentWiseCourseFee = new VmStudentWiseCourseFee();
            var listCourseFee         = (from p in ctx.FeeTbls
                                         join c in ctx.StudentInfos on p.StudentInfoId equals c.StudentInfoId
                                         where p.StudentInfoId == id
                                         select new VmodelFeeTbl
            {
                StudentInfoId = p.StudentInfoId,
                StudentName = c.StudentName,
                AdmissionDate = p.AdmissionDate,
                ImagePath = p.ImagePath,
                CourseFee = p.CourseFee,
                FeeTblId = p.FeeTblId,
                Month = p.Month,
                ExamFee = p.ExamFee
            }).ToList();

            oStudentWiseCourseFee.CourseFeeList = listCourseFee;
            // for showing category list in view
            oStudentWiseCourseFee.StudentList = (from c in ctx.StudentInfos
                                                 select new VmodelStudentInfo
            {
                StudentInfoId = c.StudentInfoId,
                StudentName = c.StudentName
            }).ToList();
            oStudentWiseCourseFee.StudentInfoId = listCourseFee.Count > 0 ? listCourseFee[0].StudentInfoId : 0;
            oStudentWiseCourseFee.StudentName   = listCourseFee.Count > 0 ? listCourseFee[0].StudentName : "";
            return(View(oStudentWiseCourseFee));
        }
コード例 #2
0
        public ActionResult Index(int?id)
        {
            var categoryWiseProductQty = from p in ctx.FeeTbls
                                         group p by p.StudentInfoId into g
                                         select new
            {
                g.FirstOrDefault().StudentInfoId,
                Qty = g.Sum(s => s.ExamFee)
            };
            var listCategory = (from c in ctx.StudentInfos
                                join cwpq in categoryWiseProductQty on c.StudentInfoId equals cwpq.StudentInfoId
                                select new VmodelStudentInfo
            {
                StudentName = c.StudentName,
                StudentInfoId = cwpq.StudentInfoId,
                TotalAmount = cwpq.Qty
            }).ToList();
            var listCourseFee = (from p in ctx.FeeTbls
                                 join c in ctx.StudentInfos on p.StudentInfoId equals c.StudentInfoId
                                 where p.StudentInfoId == id
                                 select new VmodelFeeTbl
            {
                StudentInfoId = p.StudentInfoId,
                StudentName = c.StudentName,
                AdmissionDate = p.AdmissionDate,
                ImagePath = p.ImagePath,
                CourseFee = p.CourseFee,
                FeeTblId = p.FeeTblId,
                Month = p.Month,
                ExamFee = p.ExamFee
            }).ToList();

            var oStudentWiseCourseFee = new VmStudentWiseCourseFee();

            oStudentWiseCourseFee.StudentList   = listCategory;
            oStudentWiseCourseFee.CourseFeeList = listCourseFee;
            oStudentWiseCourseFee.StudentInfoId = listCourseFee.Count > 0 ? listCourseFee[0].StudentInfoId : 0;
            oStudentWiseCourseFee.StudentName   = listCourseFee.Count > 0 ? listCourseFee[0].StudentName : "";

            return(View(oStudentWiseCourseFee));
        }