public ActionResult Create([Bind(Include = "RoleId,role,Description,DateCreated,DateUpdated")] Role role)
        {
            if (ModelState.IsValid)
            {
                db.Roles.Add(role);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(role));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "UserId,UserName,FirstName,LastName,Email,DateCreated,DateUpdated")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
        public ActionResult Create([Bind(Include = "CampaginId,Name,Description,DungeonMasterId,DateCreated,DateUpdated")] Campaign campaign)
        {
            if (ModelState.IsValid)
            {
                db.Campaigns.Add(campaign);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DungeonMasterId = new SelectList(db.Users, "UserId", "UserName", campaign.DungeonMasterId);
            return(View(campaign));
        }