Пример #1
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));
        }
Пример #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));
        }
        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));
        }
        public ActionResult Create([Bind(Include = "id,firstname,lastname,nic,course_id,batch_id,telno")] registation registation)
        {
            if (ModelState.IsValid)
            {
                db.registations.Add(registation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.batch_id  = new SelectList(db.batches, "id", "batch1", registation.batch_id);
            ViewBag.course_id = new SelectList(db.courses, "id", "course1", registation.course_id);
            return(View(registation));
        }