Created
November 6, 2015 06:29
-
-
Save guntidheerajkumar/3fe3b3d27bcdd6944a83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ConcurrentDictionary<string, ToDoItem> todoItems = new ConcurrentDictionary<string, ToDoItem>(); | |
// GET: /Sample/ | |
public ActionResult Index() | |
{ | |
var data = todoItems.Values; | |
return View(data.AsEnumerable<ToDoItem>()); | |
} | |
public ActionResult AddItem() | |
{ | |
return View(); | |
} | |
[HttpPost] | |
public ActionResult AddItem(ToDoItem item) | |
{ | |
item.Key = Guid.NewGuid().ToString(); | |
var data = todoItems.TryAdd(item.Key, item); | |
return RedirectToAction("Index"); | |
} | |
//Sample Class | |
public class ToDoItem | |
{ | |
public string Key { get; set; } | |
public string Name { get; set; } | |
public bool IsComplete { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment