示例#1
0
        public ActionResult Create(Articles articles)
        {
            if (ModelState.IsValid)
            {
                db.Articles.Add(articles);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(articles);
        }
示例#2
0
 public ActionResult Edit(Articles articles)
 {
     if (ModelState.IsValid)
     {
         db.Entry(articles).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(articles);
 }