Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            KEYWORD kEYWORD = db.KEYWORD.Find(id);

            db.KEYWORD.Remove(kEYWORD);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "PK_SEQ,EN,VI,RELATE,ORDER,STATUS")] KEYWORD kEYWORD)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kEYWORD).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kEYWORD));
 }
Exemplo n.º 3
0
        // GET: KEYWORDs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KEYWORD kEYWORD = db.KEYWORD.Find(id);

            if (kEYWORD == null)
            {
                return(HttpNotFound());
            }
            return(View(kEYWORD));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "PK_SEQ,EN,VI,RELATE,ORDER,STATUS")] KEYWORD kEYWORD)
        {
            if (ModelState.IsValid)
            {
                char[] splitchar = { ' ' };
                kEYWORD.ORDER  = kEYWORD.VI.Trim().Split().Count();
                kEYWORD.STATUS = 1;
                db.KEYWORD.Add(kEYWORD);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(kEYWORD));
        }
Exemplo n.º 5
0
            public void ShouldFilterByMemoryInputAndDisplayAlphabetically()
            {
                //arrange
                const string KEYWORD = "LFKJOWOID";
                var          mem1    = "something " + KEYWORD + " what";
                var          mem2    = "lalala";
                var          mem3    = KEYWORD.ToLower();

                _viewModel.MemoryInput = mem1;
                _viewModel.AddMemoryCommand.Execute(null);
                _viewModel.MemoryInput = mem2;
                _viewModel.AddMemoryCommand.Execute(null);
                _viewModel.MemoryInput = mem3;
                _viewModel.AddMemoryCommand.Execute(null);

                //act
                _viewModel.MemoryInput = KEYWORD;

                //assert
                _viewModel.Memories.Select(d => d.Description).Should().Have.SameSequenceAs(new[] { mem3, mem1 });
            }
Exemplo n.º 6
0
        public void InsertKeyword(string word, int thesisId)
        {
            KEYWORD kw;
            var     res = db.KEYWORDS.Where(a => a.WORD.ToUpper().Trim() == word.ToUpper().Trim());


            if (res == null || res.ToList().Count == 0)
            {
                kw = new KEYWORD()
                {
                    WORD = word.Trim()
                };

                this.db.KEYWORDS.Add(kw);
                this.db.SaveChanges();
            }
            else
            {
                kw = res.First();
            }


            var resB = db.KEYW_THESIS_ASSOCIACIONS.Where(a => a.KEYWORD_ID == kw.ID && a.THESIS_ID == thesisId);

            if (resB.ToList().Count > 0)
            {
                return;
            }


            db.KEYW_THESIS_ASSOCIACIONS.Add(new KEYW_THESIS_ASSOCIACIONS()
            {
                KEYWORD_ID = kw.ID,
                THESIS_ID  = thesisId
            });

            db.SaveChanges();
        }