Yes, the same functionality but hell-of-a-lot shorter
ConnectedCubeCategory GetIndustry(Guid industry)
{
return Data.Get<ConnectedCubeCategory>().FirstOrDefault(x => x.Id == industry);
}
ConnectedCubeCountry GetIndustry(Guid country)
{
return Data.Get<ConnectedCubeCountry>().FirstOrDefault(x => x.Id == country);
}
And if you went one step further and refactored the Id property into a seperate interface both ConnectedCubeCategory and ConnectedCubeCountry implemented you could to thisT GetReferencedObject<T>(Guid id) : where T is IInterfaceWithId
{
return Data.Get<T>().FirstOrDefault(x => x.Id == id);
}
<div class="float-left column2"> <strong>Country:</strong> @GetReferencedObject<ConnectedCubeCountry>(candidate.Country).Name </div>