Hello Team,
I notice in my controller that, it is not loading multiple data with the same Id, ei when I select term one for two or three student, the controller only load one data out of the rest.
public ActionResult getAllFeesPayment()
{
var dataList = objBasicShoolDBEntities.tblFeesPayments.Join(objBasicShoolDBEntities.tblExams,
fee => fee.FeesId,
exam => exam.ExamsTermId,
(fee, exam) => new { fee = fee, exam = exam }).Join(objBasicShoolDBEntities.tblRegistrationFees,
exam => exam.fee.RegistrationId,
registration => registration.RegistrationId,
(exam, registration) => new { registration = registration, exam = exam });
var modifiedData = dataList.GroupBy(x => new { x.exam.fee.FeesId, x.exam.fee.PaymentDate }).Select(x => new TermlyFeesPaymentViewModel
{
FeesId = x.Key.FeesId,
PaymentDate = x.FirstOrDefault().exam.fee.PaymentDate,
FirstName = x.FirstOrDefault().exam.fee.FirstName,
LastName = x.FirstOrDefault().exam.fee.LastName,
ExamsTermId = x.FirstOrDefault().exam.fee.ExamsTermId,
ExamTerm = x.FirstOrDefault().exam.fee.tblExam.ExamTerm,
RegistrationId = x.FirstOrDefault().exam.fee.RegistrationId,
ClassName = x.FirstOrDefault().exam.fee.tblRegistrationFee.ClassName,
Fees = x.FirstOrDefault().exam.fee.tblRegistrationFee.Fees,
FeesPaid = x.FirstOrDefault().exam.fee.FeesPaid,
Wallet = x.FirstOrDefault().exam.fee.Wallet
}).ToList();
return Json(modifiedData, JsonRequestBehavior.AllowGet);
}

