public async Task <IActionResult> SearchWord(string Word) { EngRusDictionaryModel model = new EngRusDictionaryModel(); model = await db.EngRusDictionary.FirstOrDefaultAsync(Eng => Eng.Word == Word); if (model != null) { return(RedirectToAction("ResultOfSearch", "EngRusDictionary", model)); } return(Content($"{Word} is not found")); }
public async Task <IActionResult> AddEngRusDictionary(EngRusDictionaryModel model) { EngRusDictionaryModel eng = db.EngRusDictionary.FirstOrDefault(dictionary => dictionary.Word == model.Word); if (eng == null) { model.UserId = db.Users.FirstOrDefault(u => u.Login == User.Identity.Name).Id; db.EngRusDictionary.Add(model); await db.SaveChangesAsync(); return(RedirectToAction("Add", "AddTheWord")); } return(Content($"this {model.Word} is available")); }
public IActionResult ResultOfSearch(EngRusDictionaryModel model) { return(View(model)); }