public ActionResult Step1(int id = -1) { Item item = null; ViewBag.TempMode = _dictService.GetDicts("temp"); if (id != -1) { item = _itemService.Get(id); IEnumerable <ItemMode> list = _itemModeService.GetItemModes(id); ViewBag.ModeID = string.Join(",", list.Select(p => p.ModeID)); ViewBag.ModeName = string.Join(",", list.Select(p => p.Mode.ModeName)); return(View(item)); } item = new Item() { Id = -1, StartDate = DateTime.Now, EndDate = DateTime.Now, SignTime = DateTime.Now }; ViewBag.ModeID = ""; ViewBag.ModeName = ""; return(View(item)); }