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

            return View(agency);
        }