示例#1
0
        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"));
        }
示例#2
0
        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"));
        }
示例#3
0
 public IActionResult ResultOfSearch(EngRusDictionaryModel model)
 {
     return(View(model));
 }