Esempio n. 1
0
 public ActionResult Edit(string Monday, string Tuesday, string Wednesday, string Thursday, string Friday, string Saturday, int StudentId)
 {
     if (Session["StudentId"] != null)
     {
         if (ModelState.IsValid)
         {
             Planning_174852 std = db.Planning_174852.Where(x => x.StudentId == StudentId).FirstOrDefault();
             if (std != null)
             {
                 std.Monday    = Monday;
                 std.Tuesday   = Tuesday;
                 std.Wednesday = Wednesday;
                 std.Thursday  = Thursday;
                 std.Friday    = Friday;
                 std.Saturday  = Saturday;
                 db.SaveChanges();
             }
             return(RedirectToAction("Index", "Student"));
         }
         return(RedirectToAction("Index", "Student"));
     }
     else
     {
         return(RedirectToAction("Login", "Student"));
     }
 }
Esempio n. 2
0
 public ActionResult Edit()
 {
     if (Session["StudentId"] != null)
     {
         try
         {
             int             id   = Convert.ToInt32(Session["StudentId"]);
             Planning_174852 plan = db.Planning_174852.Where(e => e.StudentId == id).FirstOrDefault();
             if (plan == null)
             {
                 return(RedirectToAction("Create"));
                 //return HttpNotFound();
             }
             return(View(plan));
         }
         catch (System.NullReferenceException ex)
         {
             return(RedirectToAction("Index", "Planning_174852"));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Student"));
     }
 }
Esempio n. 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Planning_174852 planning_174852 = db.Planning_174852.Find(id);

            db.Planning_174852.Remove(planning_174852);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "StudentId,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday")] Planning_174852 planning_174852)
        {
            if (ModelState.IsValid)
            {
                db.Planning_174852.Add(planning_174852);
                db.SaveChanges();
                return(RedirectToAction("Index", "Student"));
            }

            ViewBag.StudentId = new SelectList(db.Student_174852, "StudentId", "Username", planning_174852.StudentId);
            return(View(planning_174852));
        }
Esempio n. 5
0
        // GET: Planning_174852/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Planning_174852 planning_174852 = db.Planning_174852.Find(id);

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