コード例 #1
0
 public ActionResult Edit(NewsSite newssite)
 {
     if (ModelState.IsValid)
     {
         context.Entry(newssite).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(newssite);
 }
コード例 #2
0
        public ActionResult Create(NewsSite newssite)
        {
            if (ModelState.IsValid)
            {
                context.NewsSites.Add(newssite);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(newssite);
        }