public ActionResult Create([Bind(Include = "c_id,sem,section")] Class @class)
        {
            if (ModelState.IsValid)
            {
                db.Classes.Add(@class);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(@class);
        }
        public ActionResult Create([Bind(Include = "e_id,name,date,time,venue,prize,description")] Event @event)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(@event));
        }
        public ActionResult Create([Bind(Include = "organization,category,amount")] Sponsor sponsor)
        {
            if (ModelState.IsValid)
            {
                db.Sponsors.Add(sponsor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sponsor));
        }
Example #4
0
        public ActionResult Create([Bind(Include = "d_id,d_name")] Department department)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(department);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(department));
        }
        public ActionResult Create([Bind(Include = "usn,name,d_id,c_id")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.c_id = new SelectList(db.Classes, "c_id", "section", student.c_id);
            ViewBag.d_id = new SelectList(db.Departments, "d_id", "d_name", student.d_id);
            return(View(student));
        }
        // GET: Events
        public ActionResult Index(int?id)
        {
            if (id != null)
            {
                TechFestDBEntities db  = new TechFestDBEntities();
                Participant        obj = new Participant();
                obj.usn  = Session["USN"].ToString();
                obj.e_id = id;

                db.Participants.Add(obj);
                db.SaveChanges();
            }
            return(View(db.Events.ToList()));
        }