Example #1
0
        private int saveAsNew(Note item)
        {
            item.Id = Notes.Count + 1;

            Notes.Add(item);

            return item.Id;
        }
Example #2
0
        public ActionResult Save(Note note)
        {
            var manager = new NoteManager();

            manager.Save(note);

            var model = manager.GetAll();

            return PartialView("List", model);
        }
Example #3
0
        public int Save(Note item)
        {
            if (item.Id <= 0)

                return saveAsNew(item);

            var existingNote = Notes.Where(i => i.Id == item.Id).FirstOrDefault();

            existingNote.Title = item.Title;

            existingNote.Body = item.Body;

            return existingNote.Id;
        }
Example #4
0
        public ActionResult Create()
        {
            var model = new Note();

            return PartialView("NoteForm", model);
        }