複合キーの使い方がわかりません。
私のCategoriesテーブルにはCategoryId(PK、FK)、LanguageId(PK、FK)、CategoryNameがあります
CategoryId | LanguageId | CategoryName
1 | 1 | Car
1 | 2 | Auto
1 | 3 | Automobile
etc.
私はこのデザインに従っています
デフォルトのアクションは次のようになります
//
// GET: /Category/Edit/5
public ActionResult Edit(int id)
{
return View();
}
およびActionLink
<%= Html.ActionLink("Edit", "Edit", new { id= item.CategoryId }) %>
私は次のようなものを使用する必要があります
<%= Html.ActionLink("Edit", "Edit", new { id= (item.CategoryId + "-" + item.LanguageId) }) %>
したがって、URLは
/Category/Edit/5-5
と
//
// GET: /Category/Edit/5-5
public ActionResult Edit(string id)
{
// parse id
return View();
}
またはルートを次のようなものに変更します
/Category/Edit/5/5
または、もっと良い方法がありますか?