Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            M_Report m_Report = db.M_Report.Find(id);

            db.M_Report.Remove(m_Report);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        // GET: M_Report/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_Report m_Report = db.M_Report.Find(id);

            if (m_Report == null)
            {
                return(HttpNotFound());
            }
            return(View(m_Report));
        }
Example #3
0
        //[ValidateAntiForgeryToken]
        public ActionResult Deleted([Bind(Include = "ReportID,ReportContent,ReportDate,SolDate,SolutionTypeID,MessageBoardID,ReMessageBoardID,ReportUserID")] M_Report m_Report, string reportList)
        {
            var list = JsonConvert.DeserializeObject <List <ReportList> >(reportList);

            foreach (var item in list)
            {
                m_Report = db.M_Report.Find(item.ReportID);
                db.Entry(m_Report).State                 = EntityState.Modified;
                db.Entry(m_Report).Entity.SolDate        = DateTime.Now.Date;
                db.Entry(m_Report).Entity.ReportDate     = m_Report.ReportDate;
                db.Entry(m_Report).Entity.SolutionTypeID = item.SolutionTypeID;
                db.SaveChanges();
            }
            return(Content("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "ReportID,ReportContent,ReportDate,SolDate,SolutionTypeID,MessageBoardID,ReMessageBoardID,ReportUserID")] M_Report m_Report)
 {
     if (ModelState.IsValid)
     {
         db.Entry(m_Report).State             = EntityState.Modified;
         db.Entry(m_Report).Entity.SolDate    = DateTime.Now.Date;
         db.Entry(m_Report).Entity.ReportDate = Convert.ToDateTime(Request.Cookies["reportdate"].Value).Date;
         //db.Entry(m_Report).Entity.SolutionTypeID = 2;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MessageBoardID   = new SelectList(db.M_MessageBoard, "MessageBoardID", "MessageBoardContent", m_Report.MessageBoardID);
     ViewBag.ReMessageBoardID = new SelectList(db.M_ReMessageBoard, "ReMessageBoardID", "ReMessageBoardContent", m_Report.ReMessageBoardID);
     ViewBag.SolutionTypeID   = new SelectList(db.M_SolutionType, "SolutionTypeID", "SolutionTypeName", m_Report.SolutionTypeID);
     ViewBag.ReportUserID     = new SelectList(db.U_User, "UserID", "UserName", m_Report.ReportUserID);
     return(View(m_Report));
 }
Example #5
0
        public ActionResult Create([Bind(Include = "ReportID,ReportContent,ReportDate,SolDate,SolutionTypeID,MessageBoardID,ReMessageBoardID,ReportUserID")] M_Report m_Report, int id)
        {
            if (ModelState.IsValid)
            {
                db.M_Report.Add(m_Report);
                db.Entry(m_Report).Entity.ReportDate     = DateTime.Now.Date;
                db.Entry(m_Report).Entity.SolutionTypeID = 1;
                db.Entry(m_Report).Entity.ReportUserID   = Convert.ToInt32(Request.Cookies["UserID"].Value);
                db.Entry(m_Report).Entity.MessageBoardID = Convert.ToInt32(id);
                db.SaveChanges();
                //return RedirectToAction("Index");
                return(RedirectToAction("Detial", "Class", new { id = Convert.ToInt32(Request.Cookies["classid"].Value) }));
            }


            return(View(m_Report));
        }
Example #6
0
        // GET: M_Report/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_Report m_Report = db.M_Report.Find(id);

            if (m_Report == null)
            {
                return(HttpNotFound());
            }
            Response.Cookies["reportdate"].Value = db.Entry(m_Report).Entity.ReportDate.ToString();
            ViewBag.MessageBoardID   = new SelectList(db.M_MessageBoard, "MessageBoardID", "MessageBoardContent", m_Report.MessageBoardID);
            ViewBag.ReMessageBoardID = new SelectList(db.M_ReMessageBoard, "ReMessageBoardID", "ReMessageBoardContent", m_Report.ReMessageBoardID);
            ViewBag.SolutionTypeID   = new SelectList(db.M_SolutionType, "SolutionTypeID", "SolutionTypeName", m_Report.SolutionTypeID);
            ViewBag.ReportUserID     = new SelectList(db.U_User, "UserID", "UserName", m_Report.ReportUserID);

            return(View(m_Report));
        }