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));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "Id,Course1,Duration")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "Id,Lastname,Firstname,Username,Password")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
        public ActionResult Create([Bind(Include = "Id,Firstname,Lastname,Nic,Course_Id,Batch_Id,Telno")] Registration registration)
        {
            if (ModelState.IsValid)
            {
                db.Registrations.Add(registration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Batch_Id  = new SelectList(db.Batches, "Id", "Batch1", registration.Batch_Id);
            ViewBag.Course_Id = new SelectList(db.Courses, "Id", "Course1", registration.Course_Id);
            return(View(registration));
        }