コード例 #1
0
        public ActionResult Create(DivingResortModel divingresortmodel)
        {
            if (Roles.IsUserInRole("Organization"))
            {
                if (ModelState.IsValid)
                {
                    db.DivingResort.Add(divingresortmodel);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }

                return View(divingresortmodel);
            }
            else
            {
                return RedirectToAction("Index", "Home", null);
            }
        }
コード例 #2
0
 public ActionResult Edit(DivingResortModel divingresortmodel)
 {
     if (Roles.IsUserInRole("Organization"))
     {
         if (ModelState.IsValid)
         {
             db.Entry(divingresortmodel).State = EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index");
         }
         return View(divingresortmodel);
     }
     else
     {
         return RedirectToAction("Index", "Home", null);
     }
 }