// GET: Notes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ViewNote viewNote = db.ViewNotes.Find(id); if (viewNote == null) { return(HttpNotFound()); } return(View(viewNote)); }
// GET: Notes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ViewNote viewNote = (from x in db.ViewNotes where x.Notes_ID == id select x).FirstOrDefault(); viewNote.CategoryList = Repos.GetListController.GetCategoryList(); if (viewNote == null) { return(HttpNotFound()); } return(View(viewNote)); }
public ActionResult Edit(ViewNote viewNote) { if (ModelState.IsValid) { Note note = db.Notes.Find(viewNote.Notes_ID); note.NoteDescription = viewNote.NoteDescription; note.NoteCategory_ID = viewNote.NoteCategory_ID; note.SaveBy = CurrentUserName; note.SaveDateTime = DateTime.Now; db.Entry(note).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Home", null)); } return(View(viewNote)); }