Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ClassForStudents classForStudents = db.Classes.Find(id);

            db.Classes.Remove(classForStudents);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "ID,Name,year,NumberOfSections")] ClassForStudents classForStudents)
 {
     if (ModelState.IsValid)
     {
         string id = User.Identity.GetUserId();
         classForStudents.SchoolID        = id;
         db.Entry(classForStudents).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(classForStudents));
 }
Пример #3
0
        // GET: Courses/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClassForStudents classForStudents = db.Classes.Find(id);

            if (classForStudents == null)
            {
                return(HttpNotFound());
            }
            return(View(classForStudents));
        }
        public ActionResult Create([Bind(Include = "ID,SectionTitle,ClassName,StartingRegistrationNumber,EndingRegistrationNumber,SchoolID,CourseID")] ClassSection classSection)
        {
            if (ModelState.IsValid)
            {
                string           id        = User.Identity.GetUserId();
                ClassForStudents classname = db.Classes.Single(d => d.Name.Equals(classSection.ClassName));
                classSection.CourseID = classname.ID;
                classSection.SchoolID = id;
                db.Sections.Add(classSection);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(classSection));
        }