Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Extralab extralab = _extra.Get(id);

            _extra.Remove(extralab);
            //Extralab extralab = db.Extralabs.Find(id);
            //db.Extralabs.Remove(extralab);
            //db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "CourseId,Session,Price,ClassId")] Extralab extralab)
 {
     if (ModelState.IsValid)
     {
         _extra.Edit(extralab);
         //db.Entry(extralab).State = EntityState.Modified;
         //db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseId = new SelectList(_course.GetAll(), "CourseId", "CourseName", extralab.CourseId);
     //ViewBag.CourseId = new SelectList(db.Courses, "CourseId", "CourseName", extralab.CourseId);
     return(View(extralab));
 }
Example #3
0
        // GET: Admin/Extralabs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Extralab extralab = _extra.GetAll().AsQueryable().Include(c => c.Course).FirstOrDefault(x => x.CourseId == id);

            //Extralab extralab = db.Extralabs.Find(id);
            if (extralab == null)
            {
                return(HttpNotFound());
            }
            return(View(extralab));
        }
Example #4
0
        // GET: Admin/Extralabs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Extralab extralab = _extra.Get(id);

            //Extralab extralab = db.Extralabs.Find(id);
            if (extralab == null)
            {
                return(HttpNotFound());
            }
            return(View(extralab));
        }
Example #5
0
        // GET: Admin/Extralabs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Extralab extralab = _extra.Get(id);

            //Extralab extralab = db.Extralabs.Find(id);
            if (extralab == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseId = new SelectList(_course.GetAll(), "CourseId", "CourseName", extralab.CourseId);
            //ViewBag.CourseId = new SelectList(db.Courses, "CourseId", "CourseName", extralab.CourseId);
            return(View(extralab));
        }