I want to return a view if an object(country) is not null. But I get the error "Not All code paths return a value"
My code looks like this
public ActionResult Show(int id)
{
if (id != null)
{
var CountryId = new SqlParameter("@CountryId", id);
Country country = MyRepository.Get<Country>("Select * from country where CountryId=@CountryId", CountryId);
if (country != null)
{
return View(country);
}
}
}