示例#1
0
        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));
            }
        }
示例#2
0
        public string Bookmarks(GithubRepo GithubRepo)
        {
            var GithubRepoList = Session[GITHUB_REPO_LIST_KEY] as List <GithubRepo>;

            return(ToJSJson(GithubRepoList));
        }