private int saveAsNew(Note item) { item.Id = Notes.Count + 1; Notes.Add(item); return item.Id; }
public ActionResult Save(Note note) { var manager = new NoteManager(); manager.Save(note); var model = manager.GetAll(); return PartialView("List", model); }
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; }
public ActionResult Create() { var model = new Note(); return PartialView("NoteForm", model); }