コード例 #1
0
        public ActionResult Create(Sponsor sponsor)
        {
            if (ModelState.IsValid)
            {
                context.Sponsors.Add(sponsor);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.PossibleSponsorTypes = context.SponsorTypes;
            return View(sponsor);
        }
コード例 #2
0
 public ActionResult Edit(Sponsor sponsor)
 {
     if (ModelState.IsValid)
     {
         context.Entry(sponsor).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.PossibleSponsorTypes = context.SponsorTypes;
     return View(sponsor);
 }