コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AdviceBack adviceBack = db.AdviceBacks.Find(id);

            db.AdviceBacks.Remove(adviceBack);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit(AdviceBack adviceBack)
 {
     if (ModelState.IsValid)
     {
         AdviceBack advice = db.AdviceBacks.Find(adviceBack.Id);
         advice.ChangeTime   = DateTime.Now;
         advice.ChangePerson = this.Name;
         advice.Content      = adviceBack.Content;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(adviceBack));
 }
コード例 #3
0
        // GET: AdviceBack/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AdviceBack adviceBack = db.AdviceBacks.Find(id);

            if (adviceBack == null)
            {
                return(HttpNotFound());
            }
            return(View(adviceBack));
        }
コード例 #4
0
        public ActionResult Create(AdviceBack adviceBack)
        {
            if (ModelState.IsValid)
            {
                adviceBack.CompanyId    = this.CompanyId;
                adviceBack.RecordTime   = DateTime.Now;
                adviceBack.RecordPerson = this.Name;
                db.AdviceBacks.Add(adviceBack);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(adviceBack));
        }