Пример #1
0
        // GET: Colloquiums/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Colloquium colloquium = db.Colloquium.Find(id);

            if (colloquium == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseID = new SelectList(db.Course, "CourseID", "CourseName", colloquium.CourseID);
            //ViewBag.LecturerID = new SelectList(db.LecturerPerson, "LecturerID", "Name", colloquium.LecturerID);

            ViewData["LecturerID"] =
                new SelectList((from s in db.LecturerPerson
                                select new
            {
                LecturerID = s.LecturerID,
                FullName = s.Name + " " + s.Surname
            }),
                               "LecturerID", "FullName", colloquium.LecturerID);
            return(View(colloquium));
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Colloquium colloquium = db.Colloquium.Find(id);

            db.Colloquium.Remove(colloquium);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "ColloquiumID,CourseID,LecturerID,ColloquiumDate,ColloquiumStart,ColloquiumText")] Colloquium colloquium)
 {
     if (ModelState.IsValid)
     {
         db.Entry(colloquium).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseID   = new SelectList(db.Course, "CourseID", "CourseName", colloquium.CourseID);
     ViewBag.LecturerID = new SelectList(db.LecturerPerson, "LecturerID", "Name", colloquium.LecturerID);
     return(View(colloquium));
 }
Пример #4
0
        // GET: Colloquiums/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Colloquium colloquium = db.Colloquium.Find(id);

            if (colloquium == null)
            {
                return(HttpNotFound());
            }
            return(View(colloquium));
        }