コード例 #1
0
        // GET: Notification/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Notification_tbl notification_tbl = db.Notification_tbl.Find(id);

            if (notification_tbl == null)
            {
                return(HttpNotFound());
            }
            db.Notification_tbl.Remove(notification_tbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
            //return View(notification_tbl);
        }
コード例 #2
0
        // GET: Notification/Create
        public ActionResult Create(string mthd, string cntlr, string course_id, string subject, string role_not, Notification_tbl notification_tbl)
        {
            if (ModelState.IsValid)
            {
                string Not_id;
                do
                {
                    Random rnd = new Random();
                    Not_id = "Not" + (rnd.Next(100001)).ToString();
                } while (db.Notification_tbl.Find(Not_id) != null);

                notification_tbl.NotificationID = Not_id;
                notification_tbl.Description    = subject + course_id;
                notification_tbl.Role           = role_not;
                db.Notification_tbl.Add(notification_tbl);
                db.SaveChanges();
                return(RedirectToAction(mthd, cntlr));
            }

            return(null);
        }