Пример #1
0
        // 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));
        }
Пример #2
0
        // 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));
        }
Пример #3
0
        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));
        }