public JsonResult AjaxInsertWord(string wordname) { Words word = new Words(); word.Word = wordname; bool result = WordsBml.Insert(word); return Json(result, JsonRequestBehavior.AllowGet); }
public static bool Delete(Words word) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { db.Entry(word).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public static bool Insert(Words word) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { if (db.Words.Any(v => v.Word == word.Word)) return false; word.Status = false; db.Words.Add(word); db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public static bool Update(Words word) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { if (db.Words.Any(v => v.Word == word.Word)) return false; db.Entry(word).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }