public ActionResult Deactivate(int id) { var brepo = new BlogPostRepo(); brepo.DeactivatePageById(id); return RedirectToAction("ManagePages", "Admin"); }
//[Authorize(Roles = "Admin")] public ActionResult Show(int id) { var brepo = new BlogPostRepo(); var page = brepo.GetPageById(id); return View(page); }
public ActionResult Edit(int id) { var brepo = new BlogPostRepo(); var post = brepo.GetPageById(id); return View(post); }
public ActionResult _StaticLinks() { var brepo = new BlogPostRepo(); var list = brepo.GetAllStaticPages(); //"~/Views/Shared/_StaticLinks" return PartialView(list); }
public ActionResult AddStatic(StaticPage page) { var brepo = new BlogPostRepo(); brepo.AddStaticPage(page); ViewBag.Message = "A new static page has been added."; return View("Success"); }
public ActionResult Index() { var repo = new BlogPostRepo(); var list = repo.GetAllBlogPosts(); return View(list); }
public ActionResult Edit(StaticPage page) { var brepo = new BlogPostRepo(); brepo.UpdatePage(page); ViewBag.Message = "The static page has been edited successfully."; return View("Success"); //return RedirectToAction("ManagePages", "Admin"); }
public ActionResult Test() { // request by Matt BlogPostRepo repo = new BlogPostRepo(); var blogs = repo.GetAllBlogPosts(); return View(blogs); }
public ActionResult ManagePages() { var pages = new List<StaticPage>(); var repo = new BlogPostRepo(); pages = repo.GetEveryStaticPageThatExists(); return View(pages); }
public void CanGetAllBlogPosts() { BlogPostRepo repo = new BlogPostRepo(); var blogposts = repo.GetAllBlogPosts(); var count = repo.GetBlogId(); Assert.AreEqual(blogposts.Count, count); }
public void CanGetBlogPostById() { BlogPostRepo repo = new BlogPostRepo(); int testId1 = 1; int testId2 = 2; BlogPost blogpost1 = repo.GetBlogPostById(testId1); BlogPost blogpost2 = repo.GetBlogPostById(testId2); Assert.AreEqual(blogpost1.BlogID, testId1.ToString()); Assert.AreEqual(blogpost2.BlogID, testId2.ToString()); }
public void CanEditBlogPost() { BlogPostRepo repo = new BlogPostRepo(); BlogPost testPost = repo.GetBlogPostById(1); var titleBeforeEdited = testPost.Title; var titleAfterEdited = titleBeforeEdited + "UnitTest"; testPost.Title = titleAfterEdited; repo.EditBlogPost(testPost); BlogPost resultPost = repo.GetBlogPostById(1); Assert.AreNotEqual(resultPost.Title, titleBeforeEdited); Assert.AreEqual(resultPost.Title, titleAfterEdited); }
public void CanAddBlogPost() { BlogPostRepo repo = new BlogPostRepo(); var posts = repo.GetAllBlogPosts(); int preAddPostCount = posts.Count; BlogPost testPost = new BlogPost(); testPost.Title = "Unit Test"; testPost.DatePosted = DateTime.Now; testPost.Content = "Unit Test - CanAddBlogPost"; repo.AddBlogPost(testPost); var postsAfterAdd = repo.GetAllBlogPosts(); Assert.AreEqual(postsAfterAdd.Count, preAddPostCount + 1); }
public ActionResult Unpublish(int ID) { var repo = new BlogPostRepo(); repo.UnpublishPost(ID); return RedirectToAction("Index"); }
public void CanGetPageById() { BlogPostRepo repo = new BlogPostRepo(); int testId = 2; var statePage = repo.GetPageById(testId); Assert.AreEqual(statePage.StaticPageID, testId); }