public ActionResult Edit([Bind(Include = "Id,TODO")] TODOListItem tODOListItem) { if (ModelState.IsValid) { TODOListItem tODOListItemOldvalue; storage.TODOListItems.TryGetValue(tODOListItem.Id, out tODOListItemOldvalue); storage.TODOListItems.TryUpdate(tODOListItem.Id, tODOListItem, tODOListItemOldvalue); return(RedirectToAction("Index")); } return(View(tODOListItem)); }
public ActionResult Create([Bind(Include = "Id,TODO")] TODOListItem tODOListItem) { if (ModelState.IsValid) { tODOListItem.Id = storage.id; if (storage.TODOListItems.TryAdd(storage.id, tODOListItem)) { Interlocked.Increment(ref storage.id); } return(RedirectToAction("Index")); } return(View(tODOListItem)); }