public ActionResult Upd(int id) { salary_standardModel sa = MyProperty.BJSelectBy2(id); salary_standard_detailsModel da = new salary_standard_detailsModel(); List <salary_standard_detailsModel> li = MyProperty2.BJSelectBy2(sa.standard_id); foreach (salary_standard_detailsModel item in li) { if (item.item_name == "基本工资") { sa.money1 = item.salary; } if (item.item_name == "岗位工资") { sa.money2 = item.salary; } if (item.item_name == "交通补助") { sa.money3 = item.salary; } if (item.item_name == "午餐补助") { sa.money4 = item.salary; } if (item.item_name == "五险一金") { sa.money5 = item.salary; } } ViewData.Model = sa; return(View()); }