1 public ActionResult Index(YearCheckInfoRequest request)
2 {
3 //int a = -1;
4 // if (request.DisasterScale == a.ToString()) { request.DisasterScale = null; };
5 // if (request.MineName == a.ToString()) { request.MineName = null; };
6 var result = this.YearCheckService.GetYearCheckList(request);
7
8 YearCheckInfoRequest NewRequest = new YearCheckInfoRequest();
9 Dictionary<int, String> dictionary = new Dictionary<int, string>();
10 var MineNameList = this.YearCheckService.GetYearCheckList(NewRequest);
11
12 int i = 0;
13 List<String> mineNameList= new List<String>();
14
15 foreach (YearCheckInfo yearCheck in MineNameList)
16 {
17 if (!mineNameList.Contains(yearCheck.MineName))
18 {
19 mineNameList.Add(yearCheck.MineName);
20 dictionary.Add(i, yearCheck.MineName);
21 i++;
22 }
23 }
24 this.ViewBag.MineName = new SelectList(dictionary, "", "value ");
25
26 //默认查询日期
27 ViewBag.CheckTimeStart = request.CheckTimeStart.ToString("yyyy-MM-dd");
28 ViewBag.CheckTimeEnd = request.CheckTimeEnd.ToString("yyyy-MM-dd");
29
30 return View(result);
31 }
1 <label>
2 <span>矿山名称:</span>
3 @Html.DropDownList("MineName", ViewBag.MineName as SelectList, "所有记录",new { @class = "m-wrap medium" })
4
5 </label>