public RegisterSubjectBUS() { lvwRegisterSubjectState.Items.Clear(); lvwRegisteredSubjectState.Items.Clear(); new SubjectBUS(); SubjectBUS.id_course = Control.userLogin.ClassModel.Course.IdCourse; SubjectBUS.id_faculty = Control.userLogin.ClassModel.Faculty.IdFaculty; SubjectBUS.RenderListViewWithCourseAndFaculty(lvwRegisterSubjectState); List <Subject> subjects = SubjectDAL.GetSubjectsWithRegisterIdUser(Control.userLogin.IdUser); if (subjects != null) { foreach (Subject subject in subjects) { foreach (ListViewItem lvwRegisterItem in lvwRegisterSubjectState.Items) { if (lvwRegisterItem.SubItems[0].Text == subject.IdSubject) { lvwRegisterSubjectState.Items.Remove(lvwRegisterItem); } } ListViewItem item = SubjectBUS.SubjectModelToListViewItem(subject); lvwRegisteredSubjectState.Items.Add(item.Clone() as ListViewItem); } } }
/// <summary> /// 根据部门ID及其组织架构类型返回该部门下的所有科目类型 /// </summary> /// <param name="strOwnerID"></param> /// <param name="strOrgId"></param> /// <param name="strModelCode"></param> /// <param name="entRes"></param> private void GetSubjectByDeptment(string strOwnerID, string strOrgId, string strModelCode, ref List <T_FB_SUBJECT> entResList) { SubjectDAL dalSubject = new SubjectDAL(); decimal dActived = 1; var ents = from v in dalSubject.GetObjects <T_FB_SUBJECTDEPTMENT>().Include("T_FB_SUBJECT") where v.ACTIVED == dActived && v.OWNERDEPARTMENTID == strOrgId select v; string filterString = string.Empty; List <object> objArgs = new List <object>(); SMT.SaaS.BLLCommonServices.Utility ul = new SaaS.BLLCommonServices.Utility(); ul.SetOrganizationFilter(ref filterString, ref objArgs, strOwnerID, "T_FB_SUBJECTDEPTMENT"); if (ents == null) { return; } if (ents.Count() == 0) { return; } var res = ents.Select(t => t.T_FB_SUBJECT); if (res == null) { return; } entResList = res.ToList(); }
public ReturnResult <Subject> GetAllSubjectSearched(BaseCondition <Subject> condition) { SubjectDAL mouseDAL = new SubjectDAL(); var result = mouseDAL.GetAllSubjectSearched(condition); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } SubjectDAL dal = new SubjectDAL(); switch (strAction) { case "del": if (dal.UpdateVoteIsValid(strID)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; default: break; } Response.Write(strMessage); Response.End(); }
private void GuiSubjectReport_Load(object sender, EventArgs e) { SubjectsReport classesReport = new SubjectsReport(); DataTable dataTable = new DataTable(); dataTable = SubjectDAL.GetSubjectsReport(); classesReport.SetDataSource(dataTable); crystalReportViewer1.ReportSource = classesReport; }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string optionid = string.Empty; if (Request["action"] != null && Request["action"] != "") { action = Common.Common.NoHtml(Request["action"]); } if (action.Trim() != null && action.Trim() != "" && action.Trim().ToLower() == "getoption") { GetOptionList(); } #region 页面加载数据绑定 ddlSubjectList.Items.Clear(); SubjectDAL subdal = new SubjectDAL(); DataSet ds = new DataSet(); if (Session["strSiteCode"].ToString() == "ADMIN") { ds = subdal.GetVoteDataList(""); } else { ds = subdal.GetVoteDataList(" SiteCode ='" + Session["strSiteCode"].ToString() + "' "); } DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["Subject"] = "--全部--"; dt.Rows.InsertAt(dr, 0); ddlSubjectList.DataSource = ds.Tables[0].DefaultView; ddlSubjectList.DataTextField = "Subject"; ddlSubjectList.DataValueField = "ID"; ddlSubjectList.DataBind(); AspNetPager1.CurrentPageIndex = 1; string s = ""; if (Session["strSiteCode"].ToString() != "ADMIN") { s = " AND c.SiteCode = '" + Session["strSiteCode"].ToString() + "' "; } if (Request["option"] != null && Request["option"] != "") { optionid = Common.Common.NoHtml(Request["option"]); } if (optionid.Trim() != null && optionid.Trim() != "") { s += " and a.VoteID='" + optionid + "' "; } ViewState[vsKey] = s; LoadData(s); #endregion 页面加载数据绑定 } }
public static void RenderListViewRegisterWithIdUser(ListView lvwRegister, string id_user) { List <Subject> listSubject = SubjectDAL.GetSubjectsWithRegisterIdUser(id_user); foreach (Subject subject in listSubject) { ListViewItem item = SubjectBUS.SubjectModelToListViewItem(subject); lvwRegister.Items.Add(item.Clone() as ListViewItem); } }
public static void HandleAddSubject(ListView lvwSubject, Subject subject) { bool subjectResult = SubjectDAL.CreateSubject(subject); if (subjectResult) { ListViewItem item = SubjectModelToListViewItem(subject); lvwSubjectState.Items.Insert(0, item.Clone() as ListViewItem); RenderListViewWithCourseAndFaculty(lvwSubject); } }
public static List <Subject> GetSubject(int?gradeId = null) { try { return(SubjectDAL.GetSubject(gradeId)); } catch (Exception) { throw; } }
public SubjectBUS() { lvwSubjectState.Items.Clear(); List <Subject> subjects = SubjectDAL.GetSubjects(); if (subjects != null) { foreach (Subject subject in subjects) { ListViewItem item = SubjectModelToListViewItem(subject); lvwSubjectState.Items.Add(item.Clone() as ListViewItem); } } }
/// <summary> /// 获取所有 SUBJECT。 /// </summary> /// <returns>返回结果列表。</returns> public IQueryable <T_FB_SUBJECT> GetAllSubject(string strOwnerID) { SubjectDAL dalSubject = new SubjectDAL(); string filterString = string.Empty; List <object> objArgs = new List <object>(); if (!string.IsNullOrEmpty(strOwnerID)) { SMT.SaaS.BLLCommonServices.Utility ul = new SaaS.BLLCommonServices.Utility(); ul.SetOrganizationFilter(ref filterString, ref objArgs, strOwnerID, "T_FB_SUBJECT"); } return(dalSubject.GetAllSubject()); }
public void ShowActivityInfo(string strID) { SubjectDAL dal = new SubjectDAL(); DataSet ds = dal.GetVoteDetail(strID, Session["strSiteCode"].ToString()); VOTE_Subject model = DataConvert.DataRowToModel <VOTE_Subject>(ds.Tables[0].Rows[0]); this.txtName.Text = model.Subject; this.hd_content.Value = model.Content; starttime.Text = model.BeginTime.ToString("yyyy-MM-dd"); endtime.Text = model.EndTime.ToString("yyyy-MM-dd"); optionlist = ""; DataSet optionds = dal.GetOptionsData(strID); optionlist += "<table id=\"MyOption\">"; if (optionds != null && optionds.Tables.Count > 0 && optionds.Tables[0].Rows.Count > 0) { optionlist += "<script type=\"text/javascript\">"; for (int i = 0; i < optionds.Tables[0].Rows.Count; i++) { string opname = optionds.Tables[0].Rows[i]["Title"].ToString(); string opid = optionds.Tables[0].Rows[i]["ID"].ToString(); string order = optionds.Tables[0].Rows[i]["Order"].ToString(); if (optionds.Tables[0].Rows.Count > 2 && Common.Common.NoHtml(Request["action"]) != "show") { optionlist += "AddRow(\"" + opname + "\",\"" + opid + "\",\"" + order + "\",\"del\");"; } else { optionlist += "AddRow(\"" + opname + "\",\"" + opid + "\",\"" + order + "\",\"\");"; } } optionlist += "</script>"; } optionlist += "</table>"; if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; starttime.ReadOnly = true; endtime.ReadOnly = true; txtName.ReadOnly = true; } else { starttime.Attributes.Add("onclick", "WdatePicker()"); endtime.Attributes.Add("onclick", "WdatePicker()"); } }
/// <summary> /// 根据条件,获取T_FB_SUBJECT信息 /// </summary> /// <param name="strVacName"></param> /// <param name="strVacYear"></param> /// <param name="strCountyType"></param> /// <param name="strSortKey"></param> /// <returns></returns> public static IQueryable<T_FB_SUBJECT> GetAllSubjectRdListByMultSearch(string strFilter, List<object> objArgs, string strSortKey) { SubjectDAL dalSubject = new SubjectDAL(); string strOrderBy = string.Empty; if (!string.IsNullOrEmpty(strSortKey)) { strOrderBy = strSortKey; } else { strOrderBy = " SUBJECTID "; } var q = dalSubject.GetSubjectRdListByMultSearch(strOrderBy, strFilter, objArgs.ToArray()); return q; }
public static SubjectBLL GetDetails(int SubjectID) { DataTable dt = SubjectDAL.GetDetails(SubjectID).Tables[0]; SubjectBLL s; if (dt.Rows.Count > 0) { s = (SubjectBLL)dt.Rows[0]; } else { s = new SubjectBLL { ID = 0, Name = "", Type = "", Workflow = "", Status = "" }; } return(s); }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { txtTitle.Text = ""; SubjectDAL dal = new SubjectDAL(); DataSet ds = dal.GetVoteDataList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
public static void HandleDeleteSubject(ListView lvwSubject, string id_subject) { foreach (ListViewItem item in lvwSubjectState.Items) { if (item.SubItems[0].Text == id_subject) { bool result = SubjectDAL.DeleteSubjectWithId(id_subject); if (result) { lvwSubjectState.Items.Remove(item); RenderListViewWithCourseAndFaculty(lvwSubject); } return; } } MessageBox.Show(MessageBoxText.NotSelectListView, MessageBoxText.CaptionWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning); }
/// <summary> /// 根据条件,获取T_FB_SUBJECT信息 /// </summary> /// <param name="strVacName"></param> /// <param name="strVacYear"></param> /// <param name="strCountyType"></param> /// <param name="strSortKey"></param> /// <returns></returns> public static IQueryable <T_FB_SUBJECT> GetAllSubjectRdListByMultSearch(string strFilter, List <object> objArgs, string strSortKey) { SubjectDAL dalSubject = new SubjectDAL(); string strOrderBy = string.Empty; if (!string.IsNullOrEmpty(strSortKey)) { strOrderBy = strSortKey; } else { strOrderBy = " SUBJECTID "; } var q = dalSubject.GetSubjectRdListByMultSearch(strOrderBy, strFilter, objArgs.ToArray()); return(q); }
public void saveupdate() { string strID = Guid.NewGuid().ToString("N").ToUpper(); VOTE_Subject model = new VOTE_Subject(); model.ID = strID; model.Subject = Common.Common.NoHtml(Request["txtName"]); model.SiteCode = GlobalSession.strSiteCode; model.Content = Common.Common.NoHtml(Request["Content"]); model.BeginTime = Convert.ToDateTime(Request["BeginTime"]); model.EndTime = Convert.ToDateTime(Request["endtime"]); model.IsValid = Convert.ToInt32(Common.Common.NoHtml(Request["IsValid"])); SubjectDAL dal = new SubjectDAL(); if (dal.AddVoteinfo(model)) { if (Common.Common.NoHtml(Request["Option0"]) != null && Common.Common.NoHtml(Request["Option0"]) != "") { OptionDAL optdal = new OptionDAL(); VOTE_Option optmoedl = new VOTE_Option(); for (int i = 0; i < 6; i++) { optmoedl.Title = Common.Common.NoHtml(Request["Option" + i]); if (Common.Common.NoHtml(Request["Order" + i]) != null && Common.Common.NoHtml(Request["Order" + i]) != "") { optmoedl.Order = Convert.ToInt32(Common.Common.NoHtml(Request["Order" + i])); } optmoedl.ID = Guid.NewGuid().ToString("N").ToUpper(); optmoedl.SubjectID = strID; if (Common.Common.NoHtml(Request["Option" + i]) != null && Common.Common.NoHtml(Request["Option" + i]) != "") { optdal.AddVoteOption(optmoedl); } } } Response.Write("{\"success\":\"true\"}"); } else { Response.Write("{\"success\":\"操作失败\"}"); } Response.End(); }
/// <summary> /// 获取T_FB_SUBJECT信息 /// </summary> /// <param name="strSubjectId">主键索引</param> /// <returns></returns> public T_FB_SUBJECT GetSubjectByID(string strSubjectId) { if (string.IsNullOrEmpty(strSubjectId)) { return null; } SubjectDAL dalSubject = new SubjectDAL(); StringBuilder strFilter = new StringBuilder(); List<string> objArgs = new List<string>(); if (!string.IsNullOrEmpty(strSubjectId)) { strFilter.Append(" SUBJECTID == @0"); objArgs.Add(strSubjectId); } T_FB_SUBJECT entRd = dalSubject.GetSubjectRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); return entRd; }
public static void HandleUpdateSubject(ListView lvwSubject, Subject subject) { bool subjectResult = SubjectDAL.UpdateSubjectWithId(subject); if (subjectResult) { foreach (ListViewItem item in lvwSubjectState.Items) { if (item.SubItems[0].Text == subject.IdSubject) { ListViewItem itemUser = SubjectModelToListViewItem(subject); for (int i = 0; i < item.SubItems.Count; i++) { item.SubItems[i].Text = i < itemUser.SubItems.Count ? itemUser.SubItems[i].Text ?? null : string.Empty; } } } RenderListViewWithCourseAndFaculty(lvwSubject); } }
/// <summary> /// 获取T_FB_SUBJECT信息 /// </summary> /// <param name="strSubjectId">主键索引</param> /// <returns></returns> public T_FB_SUBJECT GetSubjectByID(string strSubjectId) { if (string.IsNullOrEmpty(strSubjectId)) { return(null); } SubjectDAL dalSubject = new SubjectDAL(); StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); if (!string.IsNullOrEmpty(strSubjectId)) { strFilter.Append(" SUBJECTID == @0"); objArgs.Add(strSubjectId); } T_FB_SUBJECT entRd = dalSubject.GetSubjectRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); return(entRd); }
/// <summary> /// 获取所有 SUBJECT。 /// </summary> /// <returns>返回结果列表。</returns> public IQueryable<T_FB_SUBJECT> GetAllSubject(string strOwnerID) { SubjectDAL dalSubject = new SubjectDAL(); string filterString = string.Empty; List<object> objArgs = new List<object>(); if (!string.IsNullOrEmpty(strOwnerID)) { SMT.SaaS.BLLCommonServices.Utility ul = new SaaS.BLLCommonServices.Utility(); ul.SetOrganizationFilter(ref filterString, ref objArgs, strOwnerID, "T_FB_SUBJECT"); } return dalSubject.GetAllSubject(); }
public SubjectBUS() { subjectDAL = new SubjectDAL(); }
public void saveupdate() { VOTE_Subject model = new VOTE_Subject(); model.ID = strID; model.Subject = Common.Common.NoHtml(Request["txtName"]); model.SiteCode = GlobalSession.strSiteCode; model.Content = Common.Common.NoHtml(Request["Content"]); model.BeginTime = Convert.ToDateTime(Request["BeginTime"]); model.EndTime = Convert.ToDateTime(Request["endtime"]); SubjectDAL dal = new SubjectDAL(); if (dal.UpdateVoteInfo(model)) { if (Common.Common.NoHtml(Request["Option0"]) != null && Common.Common.NoHtml(Request["Option0"]) != "") { OptionDAL optdal = new OptionDAL(); VOTE_Option optmoedl = new VOTE_Option(); int listlength = 0; optmoedl.IsDel = 1; if (Request["listlength"] != null && Request["listlength"] != "") { listlength = Convert.ToInt32(Common.Common.NoHtml(Request["listlength"])); } for (int i = 0; i < listlength; i++) { string optiontitle = string.Empty; string optionID = string.Empty; string optionOrder = string.Empty; try { optiontitle = Common.Common.NoHtml(Request["Option" + i]); } catch (Exception) { } try { optionID = Common.Common.NoHtml(Request["Option" + i + "ID"]); } catch (Exception) { } try { optionOrder = Common.Common.NoHtml(Request["Order" + i]); } catch (Exception) {} if (optiontitle != null && optiontitle != "") { optmoedl.Title = optiontitle; if (optionOrder != null && optionOrder != "") { optmoedl.Order = Convert.ToInt32(optionOrder); } if (optdal.IsexistOption(optionID)) { optmoedl.ID = optionID; optdal.UpdateOption(optmoedl); } else if (optdal.ExistOptionTile(optiontitle)) { Response.Write("{\"success\":\"该选项已经存在\"}"); } else { optmoedl.ID = Guid.NewGuid().ToString("N").ToUpper(); optmoedl.SubjectID = strID; if (optiontitle != null && optiontitle != "") { optdal.AddVoteOption(optmoedl); } } } } } Response.Write("{\"success\":\"true\"}"); } else { Response.Write("{\"success\":\"修改失败\"}"); } Response.End(); }
public SubjectBLL() { _subjectDAL = new SubjectDAL(); }
public IActionResult StudentListView() { StudentDAL dal = new StudentDAL(); List <Student> students = (List <Student>)dal.GetAllStudents(); ViewData["students"] = students; SubjectDAL dal2 = new SubjectDAL(); List <Subject> subjects = (List <Subject>)dal2.GetAllSubjects(); MarksDAL dal3 = new MarksDAL(); List <Marks> marks = (List <Marks>)dal3.GetAllMarks(); var TotalStudent = students.Count(); ViewData["TotalStudents"] = TotalStudent; var TotalSubjects = subjects.Count(); ViewData["TotalSubjects"] = TotalSubjects; //MiniMarks in each Subject var innerjoin = (from st in marks join sub in subjects on st.Subject_ID equals sub.ID select new { Subject = sub.Name, Marks = st.Value }).ToList(); var MinMarks = (from ij in innerjoin group ij by ij.Subject into ijGroup select new { Subject = ijGroup.Key, MinMarks = ijGroup.Min(x => x.Marks) }); ViewData["MiniMumMarks"] = MinMarks; //MaximumMarks in each Subject var MaxMarks = (from ij in innerjoin group ij by ij.Subject into ijGroup select new { Subject = ijGroup.Key, MaxMarks = ijGroup.Max(x => x.Marks) }); ViewData["MaxMarks"] = MaxMarks; //Avergae in each Subject var AvgMarks = (from ij in innerjoin group ij by ij.Subject into ijGroup select new { Subject = ijGroup.Key, AvgMarks = ijGroup.Average(x => x.Marks) }); ViewData["AvgMarks"] = AvgMarks; var crossjoin = (from st in students from sub in subjects select new { st.ID, st.Name, st.Email, st.Address, st.Class, Subject = sub.Name, Subject_ID = sub.ID }).ToList(); var mark = (from m in marks from cs in crossjoin where m.Student_ID == cs.ID && m.Subject_ID == cs.Subject_ID select new { cs.ID, cs.Name, cs.Email, cs.Address, cs.Class, cs.Subject_ID, Marks = m.Value, cs.Subject } ).ToList(); ViewData["crossjoin"] = mark; //Highestmarks var stud = from s in mark group s by s.Subject into stugrp let topp = stugrp.Max(x => x.Marks) select new { Subject = stugrp.Key, TopStudent = stugrp.First(y => y.Marks == topp).ID, MaximumMarks = topp } ; var HighestMarks = (from h in mark from st in stud where h.ID == st.TopStudent && h.Subject == st.Subject select new { Name = h.Name, Email = h.Email, Address = h.Address, Subject = st.Subject, Marks = st.MaximumMarks }).ToList(); ViewData["HighestMarks"] = HighestMarks; //Lowest Marks var Loweststud = from s in mark group s by s.Subject into Loweststudgrp let low = Loweststudgrp.Min(x => x.Marks) select new { Subject = Loweststudgrp.Key, TopStudent = Loweststudgrp.First(y => y.Marks == low).ID, LowestMarks = low } ; var lowestMarks = (from h in mark from st in Loweststud where h.ID == st.TopStudent && h.Subject == st.Subject select new { Name = h.Name, Email = h.Email, Address = h.Address, Subject = st.Subject, Marks = st.LowestMarks }).ToList(); ViewData["lowestMarks"] = lowestMarks; return(View()); }
public static List <SubjectBLL> List() { return(SubjectDAL.List().Tables[0].AsEnumerable().Select(dr => (SubjectBLL)dr).ToList()); }
public int SaveSubject(SubjectEntities subjectEntities) { SubjectDAL subjectDAL = new SubjectDAL(); return(subjectDAL.SaveSubject(subjectEntities)); }
public SubjectEntities GetSubjectByID(int ID) { SubjectDAL subjectDAL = new SubjectDAL(); return(subjectDAL.GetSubjectByID(ID)); }
public int DeleteSubject(int ID) { SubjectDAL subjectDl = new SubjectDAL(); return(subjectDl.DeleteSubject(ID)); }
/// <summary> /// 根据部门ID及其组织架构类型返回该部门下的所有科目类型 /// </summary> /// <param name="strOwnerID"></param> /// <param name="strOrgId"></param> /// <param name="strModelCode"></param> /// <param name="entRes"></param> private void GetSubjectByDeptment(string strOwnerID, string strOrgId, string strModelCode, ref List<T_FB_SUBJECT> entResList) { SubjectDAL dalSubject = new SubjectDAL(); decimal dActived = 1; var ents = from v in dalSubject.GetObjects<T_FB_SUBJECTDEPTMENT>().Include("T_FB_SUBJECT") where v.ACTIVED == dActived && v.OWNERDEPARTMENTID == strOrgId select v; string filterString = string.Empty; List<object> objArgs = new List<object>(); SMT.SaaS.BLLCommonServices.Utility ul = new SaaS.BLLCommonServices.Utility(); ul.SetOrganizationFilter(ref filterString, ref objArgs, strOwnerID, "T_FB_SUBJECTDEPTMENT"); if (ents == null) { return; } if (ents.Count() == 0) { return; } var res = ents.Select(t => t.T_FB_SUBJECT); if (res == null) { return; } entResList = res.ToList(); }
public List <SubjectEntities> GetSubjectPageWise(int pageIndex, ref int recordCount, int length) { SubjectDAL subjectDAL = new SubjectDAL(); return(subjectDAL.GetSubjectPageWise(pageIndex, ref recordCount, length)); }
public IActionResult StudentListView() { StudentDAL dal = new StudentDAL(); List <Student> students = (List <Student>)dal.GetAllStudents(); ViewData["students"] = students; SubjectDAL dal2 = new SubjectDAL(); List <Subject> subjects = (List <Subject>)dal2.GetAllSubjects(); var innerjoin = (from st in students join sub in subjects on st.ID equals sub.StudentId select new { st.ID, st.Name, st.Email, st.Address, st.Class, Subject = sub.Name }).ToList(); ViewData["innerjoin"] = innerjoin; var leftjoin = (from st in students join sub in subjects on st.ID equals sub.StudentId into a from b in a.DefaultIfEmpty(new Subject()) select new { st.ID, st.Name, st.Email, st.Address, st.Class, Subject = b.Name }).ToList(); ViewData["leftjoin"] = leftjoin; var crossjoin = (from st in students from sub in subjects select new { st.ID, st.Name, st.Email, st.Address, st.Class, Subject = sub.Name }).ToList(); ViewData["crossjoin"] = crossjoin; var groupjoin = students.GroupJoin(subjects, st => st.ID, sub => sub.StudentId, (st, sub) => new { Key = st.ID, Name = st.Name, subjects = sub }); ViewData["groupjoin"] = groupjoin; return(View()); }