public ActionResult Update(int id, int selectedCommunity) { Blog thisBlog = Blog.FindById(id); thisBlog.AddCommunity(selectedCommunity); return(RedirectToAction("Show", new{ id = id })); }
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); }