public async Task <ActionResult> CodeEdit(int codeID, int typeID) { var model = await codeRepo.GetCodeAsync(codeID); if (model == null) { model = new Codes() { Status = 1, TypeId = typeID }; } var StatusList = new List <SelectListItem>(); StatusList.Add(new SelectListItem() { Value = "1", Text = "正常显示", Selected = true }); StatusList.Add(new SelectListItem() { Value = "0", Text = "隐藏" }); ViewBag.StatusList = StatusList; return(View(model)); }