Exemple #1
0
 public ActionResult Delete(int id, Article article)
 {
     try
     {
         using (var db = new ArticleEntities())
         {
             db.Entry(article).State = EntityState.Deleted;
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch
     {
         return View();
     }
 }
Exemple #2
0
 public ActionResult Edit(int id, Article article)
 {
     try
     {
         using (var db = new ArticleEntities())
         {
             article.EditDate = DateTime.Now;
             article.EditUser = User.Identity.Name;
             article.Text = HttpUtility.UrlDecode(article.Text, System.Text.Encoding.Default);
             db.Entry(article).State = EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch
     {
         return View();
     }
 }