Example #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            Event_tbl event_tbl = db.Event_tbl.Find(id);

            db.Event_tbl.Remove(event_tbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "ID,Title,Description,ReleaseDate,Type,Ed_Level,CourseID")] Event_tbl event_tbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(event_tbl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseID = new SelectList(db.Course_tbl, "ID", "Name", event_tbl.CourseID);
     return(View(event_tbl));
 }
Example #3
0
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Event_tbl event_tbl = db.Event_tbl.Find(id);

            if (event_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(event_tbl));
        }
Example #4
0
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Event_tbl event_tbl = db.Event_tbl.Find(id);

            if (event_tbl == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseID = new SelectList(db.Course_tbl, "ID", "Name", event_tbl.CourseID);
            return(View(event_tbl));
        }
Example #5
0
        public ActionResult Create(Event_tbl event_tbl)
        {
            if (ModelState.IsValid)
            {
                event_tbl.ReleaseDate = DateTime.Now;
                db.Event_tbl.Add(event_tbl);
                db.SaveChanges();
                //Add notification
                return(RedirectToAction("Create", "Notification", new
                {
                    mthd = "Index",
                    cntlr = "Event",
                    course_id = event_tbl.ReleaseDate.ToString(),
                    subject = "New Event is added at ",
                    role_not = "Student"
                }));
                //return RedirectToAction("Index");
            }

            ViewBag.CourseID = new SelectList(db.Course_tbl, "ID", "Name", event_tbl.CourseID);
            return(View(event_tbl));
        }