3
オブジェクト(国)がnullでない場合、ビューを返したいと思います。しかし、私はエラー「すべてのコードパスが値を返さない」MVCでビューを返すときに「すべてのコードパスが値を返すわけではありません」
は私のコードは、この
public ActionResult Show(int id)
{
if (id != null)
{
var CountryId = new SqlParameter("@CountryId", id);
Country country = MyRepository.Get<Country>("Select * from country where [email protected]", CountryId);
if (country != null)
{
return View(country);
}
}
}