public ActionResult Bookmark(GithubRepo GithubRepo) { if (Session[GITHUB_REPO_LIST_KEY] == null) { Session[GITHUB_REPO_LIST_KEY] = new List <GithubRepo>(); } var GithubRepoList = Session[GITHUB_REPO_LIST_KEY] as List <GithubRepo>; if (GithubRepoList.Any(x => x.Name == GithubRepo.Name)) { return(new HttpStatusCodeResult(400, "bookmark already exists")); } else { GithubRepoList.Add(GithubRepo); return(new HttpStatusCodeResult(200)); } }
public string Bookmarks(GithubRepo GithubRepo) { var GithubRepoList = Session[GITHUB_REPO_LIST_KEY] as List <GithubRepo>; return(ToJSJson(GithubRepoList)); }