Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "ID,FirstName,LastName,UserName,Password")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "ID,Batch1,Year")] Batch batch)
        {
            if (ModelState.IsValid)
            {
                db.Batches.Add(batch);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(batch));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "ID,CourseName,Duration")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
        public ActionResult Create([Bind(Include = "ID,FirstName,LastName,nic,Course_ID,Batch_ID,Phone")] Regstration regstration)
        {
            if (ModelState.IsValid)
            {
                db.Regstrations.Add(regstration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Batch_ID  = new SelectList(db.Batches, "ID", "Batch1", regstration.Batch_ID);
            ViewBag.Course_ID = new SelectList(db.Courses, "ID", "CourseName", regstration.Course_ID);
            return(View(regstration));
        }