Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "ID,Location,Date,EventListID")] Event @event)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EventListID = new SelectList(db.EventLists, "ID", "Name", @event.EventListID);
            return(View(@event));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "ID,FirstName,LastName,Gender,Age,Active,LoginID")] Person person)
        {
            if (ModelState.IsValid)
            {
                db.People.Add(person);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.LoginID = new SelectList(db.Logins, "ID", "UserName", person.LoginID);
            return(View(person));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "ID,Time1,PersonID,EventID")] Time time)
        {
            if (ModelState.IsValid)
            {
                db.Times.Add(time);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EventID  = new SelectList(db.Events, "ID", "Location", time.EventID);
            ViewBag.PersonID = new SelectList(db.People, "ID", "FirstName", time.PersonID);
            return(View(time));
        }