Last updated: 04.08.17 by Jonas Solsvik
HTTP Method
GET
URL
http://localhost:5000/api/translation/keyvalue/? clientKey=Ordbase
& languageKey=
&containerKey=error_messages
& translationKey=
JSON Response
[
{
"key": "error_create_client",
"value": "Failed to create client. Client may already exist"
},
{
"key": "error_create_client",
"value": "Fikk ikke til å lage ny klient. Klienten finnes kanskje fra før?"
}
]
Response type
[] KeyValuePair<string, string>
[HttpGet("api/translation/keyvalue")]
public IEnumerable<KeyValuePair<string,string>> GetKeyValue([FromQuery] TranslationQuery query)
{
return _translationRepo.GetKeyValue(query);
}
public IEnumerable<KeyValuePair<string,string>> GetKeyValue (TranslationQuery query)
{
return (from t in _context.Translation
where t.ClientKey == query.ClientKey || query.ClientKey == null
where t.LanguageKey == query.LanguageKey || query.LanguageKey == null
where t.ContainerKey == query.ContainerKey || query.ContainerKey == null
where t.Key == query.TranslationKey || query.TranslationKey == null
select new KeyValuePair<string,string>(t.Key, t.Text)).ToArray();
}