public IActionResult Translate(TranslateWordDto model) { if (!ModelState.IsValid) { return(Json(new { success = false, response = "Введите правильные данные" })); } var response = dictionaryService.TranslateWord(model); if (response == null) { return(Json(new { success = false, response = "В словаре нет подходящего слова" })); } return(Json(new { success = true, response })); }
public string TranslateWord(TranslateWordDto dto) { var result = uow.WordsRepository.TranslateWord(dto.Word, dto.TranslatingLangId, dto.TranslatedLangId); return(dto.Word.Equals(result?.Translate) ? result?.Original : result?.Translate); }