public ActionResult EditAssign(decimal id = 0) { var project_ins = db.TPR_PROJECT_INSTITUTE.Single(t => t.PROJECT_INS_NO == id); TPR_PROJECT project = db.TPR_PROJECT.Include("SET_CLASS").Single(p => p.PROJECT_NO == project_ins.PROJECT_NO); USER_INFO_VIEWMODEL zonal_info = (from u in db.SEC_USERS join d in db.SET_DESIGNATION on u.DESIG_NO equals d.DESIG_NO join t in db.SET_THANA on u.THANA_NO equals t.THANA_NO join z in db.SET_ZILLA on t.ZILLA_NO equals z.ZILLA_NO join div in db.SET_DIVISION on z.DIVISION_NO equals div.DIVISION_NO where u.USER_NO == project_ins.USER_NO select new USER_INFO_VIEWMODEL { userno = u.USER_NO, fullname = u.USER_FULL_NAME, username = u.USER_NAME, hrid = u.HR_EMP_ID, mobile = u.USER_MOBILE, designation = d.DESIG_NAME, thana = t.THANA_NAME, zilla = z.ZILLA_NAME, division = div.DIVISION_NAME }).FirstOrDefault(); INSTITUTE_INFO_VIEWMODEL institute_info = (from i in db.SET_INSTITUTE join t in db.SET_THANA on i.THANA_NO equals t.THANA_NO join z in db.SET_ZILLA on t.ZILLA_NO equals z.ZILLA_NO join d in db.SET_DIVISION on z.DIVISION_NO equals d.DIVISION_NO where i.INSTITUTE_NO == project_ins.INSTITUTE_NO select new INSTITUTE_INFO_VIEWMODEL { insname = i.INSTITUTE_NAME, inscode = i.INSTITUTE_NO, thana = t.THANA_NAME, zilla = z.ZILLA_NAME, division = d.DIVISION_NAME }).FirstOrDefault(); ViewBag.Subjects = db.SET_CLASS_SUBJECT_ASSIGN_GET(id, project.CLASS_NO).ToList(); ViewBag.PROJECT = Session["TPR_PROJECT"] = project; ViewBag.ZONAL_INFO = Session["TPR_ZONAL_INFO"] = zonal_info; ViewBag.INSTITUTE_INFO = Session["TPR_INS_INFO"] = institute_info; ViewBag.PROJECT_INSTITITE = Session["TPR_PROJECT_INS"] = project_ins; return(View()); }