예제 #1
0
        public ActionResult Create(News news)
        {
            if (ModelState.IsValid)
            {
                news.ID = Guid.NewGuid();
                db.News.Add(news);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(news);
        }
예제 #2
0
 public ActionResult Edit(News news)
 {
     if (ModelState.IsValid)
     {
         db.Entry(news).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(news);
 }