I have a helper method which retrieves data in a database asynchronously. The method works fine and is able to retrieve the data I need. Here is the method:
public static async Task<string> Translate(string word, string LanguageID,string token)
{
if (!_HasLoadedTranslationList)
_TranslationList = await GetTranslationList(token);
foreach (TranslationDto translation in _TranslationList)
{
switch (LanguageID)
{
case "Chinese":
if (translation.nameID.ToLower() == word.ToLower())
{
return translation.Chinese;
}
break;
case "English":
if (translation.nameID.ToLower() == word.ToLower())
{
return translation.nameID;
}
break;
default:
break;
}
}
return null;
}
Now, this is initially called when rendering the View (using ASP.NET MVC btw):
<h1>@LanguageHelper.Translate("SIGN IN", @ViewBag.LanguageID,@ViewBag.Token)</h1>
However, instead of displaying the string, it displays
System.Threading.Tasks.Task`1[System.String]
How can I get the actual string value in the View?