public ActionResult AddStaticPages(StaticPage newStaticPage) { var repo = new BlogPostRepository(); repo.AddNewStaticPage(newStaticPage); return RedirectToAction("Index", "Home"); }
public void AddNewStaticPage(StaticPage newStaticPage) { var p = new DynamicParameters(); newStaticPage.StaticPageDate = DateTime.Today; p.Add("StaticPageDate", newStaticPage.StaticPageDate); p.Add("StaticPageTitle", newStaticPage.StaticPageTitle); p.Add("StaticPageContent", newStaticPage.StaticPageContent); p.Add("StaticPageID", dbType: DbType.Int32, direction: ParameterDirection.Output); _cn.Execute("AddNewStaticPage", p, commandType: CommandType.StoredProcedure); p.Get<int>("StaticPageID"); }
public ActionResult EditStaticPage(StaticPage editedStaticPage) { var ops = new BlogPostOperations(); ops.EditStaticPage(editedStaticPage); //what view should be returned? return RedirectToAction("Index", "Home"); }
public void EditStaticPage(StaticPage pageToEdit) { _repo.EditStaticPage(pageToEdit); }
public void EditStaticPage(StaticPage editedStaticPage) { //different stored procedure for updating each field in order to retainn same StaticPageId var p = new DynamicParameters(); p.Add("StaticPageId", editedStaticPage.StaticPageID); p.Add("newStaticPageTitle", editedStaticPage.StaticPageTitle); p.Add("newStaticPageContent", editedStaticPage.StaticPageContent); _cn.Execute("UpdateStaticPage", p, commandType: CommandType.StoredProcedure); }