public ActionResult DeleteConfirmed(int id) { AdviceBack adviceBack = db.AdviceBacks.Find(id); db.AdviceBacks.Remove(adviceBack); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
// 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)); }
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)); }