public ActionResult DeleteConfirmed(int id)
        {
            //if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            //{
            //    return RedirectToAction("Login", "Home");
            //}
            StudentPromotTable studentPromotTable = db.StudentPromotTables.Find(id);

            db.StudentPromotTables.Remove(studentPromotTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "StudentPromotID,StudentID,ClassID,SessionID,ProgrameSessionID,PromoteDate,AnnualFee,IsActive,IsSubmit")] StudentPromotTable studentPromotTable)
 {
     if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
     {
         return(RedirectToAction("Login", "Home"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(studentPromotTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClassID           = new SelectList(db.ClassTables, "ClassID", "Name", studentPromotTable.ClassID);
     ViewBag.ProgrameSessionID = new SelectList(db.ProgrameSessionTables, "ProgrameSessionID", "Details", studentPromotTable.ProgrameSessionID);
     ViewBag.StudentID         = new SelectList(db.StudentTables, "StudentID", "Name", studentPromotTable.StudentID);
     return(View(studentPromotTable));
 }
        // GET: StudentPromotTables/Details/5
        public ActionResult Details(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentPromotTable studentPromotTable = db.StudentPromotTables.Find(id);

            if (studentPromotTable == null)
            {
                return(HttpNotFound());
            }
            return(View(studentPromotTable));
        }
        public ActionResult Edit(StudentPromotTable studentPromotTable)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            //int userid = Convert.ToInt32(Convert.ToString(Session["UserID"]));
            //studentPromotTable.UserID = userid;

            if (ModelState.IsValid)
            {
                db.Entry(studentPromotTable).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ClassID           = new SelectList(db.ClassTables, "ClassID", "Name", studentPromotTable.ClassID);
            ViewBag.ProgrameSessionID = new SelectList(db.ProgrameSessionTables, "ProgrameSessionID", "Details", studentPromotTable.ProgrameSessionID);
            ViewBag.SectionID         = new SelectList(db.SectionTables, "SectionID", "SectionName", studentPromotTable.SectionID);
            ViewBag.StudentID         = new SelectList(db.StudentTables, "StudentID", "Name", studentPromotTable.StudentID);
            return(View(studentPromotTable));
        }
예제 #5
0
        // GET: StudentPromotTables/Edit/5
        public ActionResult Edit(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentPromotTable studentPromotTable = db.StudentPromotTables.Find(id);

            if (studentPromotTable == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClassID           = new SelectList(db.ClassTables, "ClassID", "Name", studentPromotTable.ClassID);
            ViewBag.ProgrameSessionID = new SelectList(db.ProgrameSessionTables, "ProgrameSessionID", "Details", studentPromotTable.ProgrameSessionID);
            ViewBag.StudentID         = new SelectList(db.StudentTables, "StudentID", "Name", studentPromotTable.StudentID);
            return(View(studentPromotTable));
        }