コード例 #1
0
        public ActionResult Update(int id, int selectedCommunity)
        {
            Blog thisBlog = Blog.FindById(id);

            thisBlog.AddCommunity(selectedCommunity);
            return(RedirectToAction("Show", new{ id = id }));
        }
コード例 #2
0
        public void GetCommunities_ReturnsBlogCommunities_CommunityList()
        {
            Community newCommunity = new Community("", "");

            newCommunity.Save();
            Blog newBlog = new Blog("", "");

            newBlog.Save();
            newBlog.AddCommunity(newCommunity.GetId());
            List <Community> result        = newBlog.GetCommunities();
            List <Community> communityList = new List <Community> {
                newCommunity
            };

            Console.WriteLine(result.Count);
            Console.WriteLine(communityList.Count);
            CollectionAssert.AreEqual(result, communityList);
        }