public ActionResult DeleteConfirmed(int id) { Trace.WriteLine("POST /Notes/Delete/" + id); InfraNote note = db.notes.Find(id); db.notes.Remove(note); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id, Name, Description,CreatedDate")] InfraNote note) { Trace.WriteLine("POST /Notes/Edit/" + note.ID); if (ModelState.IsValid) { db.Entry(note).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(note)); }
public ActionResult Create([Bind(Include = "Name, Description,CreatedDate")] InfraNote note) { Trace.WriteLine("POST /Notes/Create"); if (ModelState.IsValid) { db.notes.Add(note); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(note)); }
// GET: Notes/Edit/5 public ActionResult Edit(int?id) { Trace.WriteLine("GET /Notes/Edit/" + id); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InfraNote note = db.notes.Find(id); if (note == null) { return(HttpNotFound()); } return(View(note)); }