public ActionResult DeleteConfirmed(int id) { KEYWORD kEYWORD = db.KEYWORD.Find(id); db.KEYWORD.Remove(kEYWORD); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
// 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)); }
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)); }
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 }); }
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(); }