public void TestCreateStatic() { var operations = new BlogOperations(new MockRepo()); var staticEntry = new StaticEntry(); operations.CreateStaticEntry(staticEntry); Assert.AreEqual(4, operations.GetStaticEntries().Count); }
public void TestCreateStatic() { var operations = new BlogOperations(new MockRepo()); var staticEntry = new StaticEntry(); operations.CreateStaticEntry(staticEntry); Assert.AreEqual(4, operations.GetStaticEntries().Count); }
public HttpResponseMessage Post(StaticEntry staticEntry) { var blogOp = new BlogOperations(); blogOp.CreateStaticEntry(staticEntry); var response = Request.CreateResponse(HttpStatusCode.Created, staticEntry); return response; }
public HttpResponseMessage Post(StaticEntry staticEntry) { var blogOp = new BlogOperations(); blogOp.CreateStaticEntry(staticEntry); var response = Request.CreateResponse(HttpStatusCode.Created, staticEntry); return(response); }
public void CreateStaticPage(StaticEntry staticEntry) { using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { var cmd = new SqlCommand("CreateStaticEntry", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Content", staticEntry.Content); cmd.Parameters.AddWithValue("@Title", staticEntry.Title); cn.Open(); cmd.ExecuteNonQuery(); } }
public void CreateStaticPage(StaticEntry staticEntry) { using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { var cmd = new SqlCommand("CreateStaticEntry", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Content", staticEntry.Content); cmd.Parameters.AddWithValue("@Title", staticEntry.Title); cn.Open(); cmd.ExecuteNonQuery(); } }
public void TestGetStatic() { var operations = new BlogOperations(new MockRepo()); var expected = new StaticEntry() { StaticPageID = 4, Content = "Fake Content" + 4, Title = "Fake Title" + 4, url = "/Fakeurl" }; operations.CreateStaticEntry(expected); Assert.AreEqual(expected, operations.GetStaticEntry(4)); }
public ActionResult EditStatic(int id, StaticEntry staticEntry) { try { var blogOp = new BlogOperations(); blogOp.EditStaticEntry(staticEntry); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult CreateStatic(StaticEntry staticEntry) { try { var blogOp = new BlogOperations(); blogOp.CreateStaticEntry(staticEntry); return RedirectToAction("Index"); } catch { return View(); } }
public StaticEntry GetStatic(int id) { var temp = new StaticEntry(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { var cmd = new SqlCommand("GetStaticEntry", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StaticPageID", id); cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { temp.StaticPageID = dr.GetInt32(0); temp.Title = dr.GetString(1); temp.Content = dr.GetString(2); return(temp); } } } return(temp); }
public List <StaticEntry> GetAllStatic() { var staticEntries = new List <StaticEntry>(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { var cmd = new SqlCommand("GetStaticEntries", cn); cmd.CommandType = CommandType.StoredProcedure; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { var temp = new StaticEntry(); temp.StaticPageID = dr.GetInt32(0); temp.Content = dr.GetString(1); temp.Title = dr.GetString(2); staticEntries.Add(temp); } } } return(staticEntries); }
public StaticEntry GetStatic(int id) { var temp = new StaticEntry(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { var cmd = new SqlCommand("GetStaticEntry", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StaticPageID", id); cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { temp.StaticPageID = dr.GetInt32(0); temp.Title = dr.GetString(1); temp.Content = dr.GetString(2); return temp; } } } return temp; }
public void EditStaticEntry(StaticEntry staticEntry) { _blogRepo.EditStaticEntry(staticEntry); }
public void CreateStaticEntry(StaticEntry staticEntry) { _blogRepo.CreateStaticPage(staticEntry); }
//GET: Blog/CreateStatic public ActionResult CreateStatic() { var staticEntry = new StaticEntry(); return View(staticEntry); }
public ActionResult EditStatic(int id, StaticEntry staticEntry) { try { var blogOp = new BlogOperations(); blogOp.EditStaticEntry(staticEntry); return RedirectToAction("Index"); } catch { return View(); } }
public void CreateStaticPage(StaticEntry staticEntry) { Static.Add(staticEntry); }
public void EditStaticEntry(StaticEntry staticEntry) { GetStatic(2); staticEntry.Content = "edit"; }
//GET: Blog/CreateStatic public ActionResult CreateStatic() { var staticEntry = new StaticEntry(); return(View(staticEntry)); }
public void EditStaticEntry(StaticEntry staticEntry) { _blogRepo.EditStaticEntry(staticEntry); }
public void CreateStaticEntry(StaticEntry staticEntry) { _blogRepo.CreateStaticPage(staticEntry); }
public List<StaticEntry> GetAllStatic() { var staticEntries = new List<StaticEntry>(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { var cmd = new SqlCommand("GetStaticEntries", cn); cmd.CommandType = CommandType.StoredProcedure; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { var temp = new StaticEntry(); temp.StaticPageID = dr.GetInt32(0); temp.Content = dr.GetString(1); temp.Title = dr.GetString(2); staticEntries.Add(temp); } } } return staticEntries; }
public void TestGetStatic() { var operations = new BlogOperations(new MockRepo()); var expected = new StaticEntry() { StaticPageID = 4, Content = "Fake Content" + 4, Title = "Fake Title" + 4, url = "/Fakeurl" }; operations.CreateStaticEntry(expected); Assert.AreEqual(expected, operations.GetStaticEntry(4)); }
public void EditStaticEntry(StaticEntry staticEntry) { GetStatic(2); staticEntry.Content = "edit"; }
public void CreateStaticPage(StaticEntry staticEntry) { Static.Add(staticEntry); }