// GET: healthSystem public ActionResult StartCheckMaster() //啟動作業主頁 { healthSystemStartCheckMaster data = new healthSystemStartCheckMaster(); //查詢存在的年度,Distinct()可以去除掉查詢出來後重複的值 var query = from o in db.StartCheck select o.start_year; data.year = query.Distinct().ToList(); //查詢空的給StartCheck var query1 = from o in db.StartCheck where o.Start_id == null select o; data.startCheck = query1.ToList(); return(View(data)); }
public ActionResult StartCheckMaster(StartCheck data) { if (string.IsNullOrEmpty(data.start_state)) { data.start_state = ""; } healthSystemStartCheckMaster viewData = new healthSystemStartCheckMaster(); //查詢存在的年度,Distinct()可以去除掉查詢出來後重複的值 var query = from o in db.StartCheck select o.start_year; viewData.year = query.Distinct().ToList(); //查詢後給StartCheck var query1 = from o in db.StartCheck where o.start_year == data.start_year && o.start_state.Contains(data.start_state) select o; viewData.startCheck = query1.ToList(); return(View(viewData)); }