Пример #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();
     }
 }
Пример #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();
     }
 }