实例变量的值默认为0,

时间:2016-06-22 06:51:56

标签: c# asp.net-mvc

public ActionResult Edit(int country_id = 0)       
{  
    tbl_country Data = db.tbl_country.Find(country_id);
    int a = country_id;
    create_tbl_country c = new create_tbl_country();
    c.country_name = Data.country_name;
    c.country_id = 1; // here taking value of c.country_id=0 
    return View(c);
}

1 个答案:

答案 0 :(得分:0)

仅使用“id”更改“country_id”。

相关问题