public ActionResult UpdateEntry(string hdnBP_UID, string txtTitle, string taBody) { try { // TODO: Add insert logic here T_BlogPost bp = new T_BlogPost(); //bp.BP_UID = (Guid) System.Convert.ChangeType(Request.Params["hdnBP_UID"], typeof(Guid)); bp.BP_UID = new System.Guid(hdnBP_UID); bp.BP_Title = txtTitle; // Request.Params["txtTitle"]; bp.BP_Content = taBody; // Request.Params["taBody"]; // this.m_dal.Insert<T_BlogPost>(bp); return(RedirectToAction("Success")); } catch { // return View(); int num1 = 1; int num2 = 2; int result = 3; return(Content($"Result of {num1} + {num2} is {result}", "text/plain")); } } // End Action AddEntry
public ActionResult AddEntry(string txtTitle, string taBody) { try { // TODO: Add insert logic here T_BlogPost bp = new T_BlogPost(); bp.BP_Title = txtTitle; // Request.Params["txtTitle"]; bp.BP_Title = taBody; // Request.Params["taBody"]; // this.m_dal.Insert<T_BlogPost>(bp); return(RedirectToAction("Success")); } catch (System.Exception ex) { // return View(); return(Json(new { success = false, responseText = ex.Message, stackTrace = ex.StackTrace })); } } // End Action AddEntry
} // End Action ShowEntry // // GET: /Blog/Delete/5 public ActionResult EditEntry(string id) { T_BlogPost bp = null; // string sql = "SELECT {0} BP_UID string sql = "SELECT {0} BP_UID FROM T_BlogPost ORDER BY BP_EntryDate DESC" + this.m_fac.PagingTemplate(1); using (System.Data.Common.DbConnection con = this.m_fac.Connection) { id = con.QuerySingle <string>(sql); } sql = "SELECT * FROM T_BlogPost WHERE BP_UID = @__bp_uid"; using (System.Data.Common.DbConnection con = this.m_fac.Connection) { bp = con.QuerySingle <T_BlogPost>(sql, new { __bp_uid = new System.Guid(id) }); } return(View(bp)); } // End Action EditEntry
} // End Function GetMachineId // // GET: /Blog/Delete/5 public ActionResult ShowEntry(string id) { T_BlogPost bp = null; string lol = "http://localhost/image.aspx?&postimage_text=%0A%5Burl%3Dhttp%3A%2F%2Fpostimg.org%2Fimage%2Fu0zc6aznf%2F%5D%5Bimg%5Dhttp%3A%2F%2Fs1.postimg.org%2Fu0zc6aznf%2Fhtc_hero_wallpaper_03.jpg%5B%2Fimg%5D%5B%2Furl%5D%0A"; //"http://localhost/image.aspx?&postimage_text=[url=http://postimg.org/image/u0zc6aznf/][img]http://s1.postimg.org/u0zc6aznf/htc_hero_wallpaper_03.jpg[/img][/url] lol = System.Web.HttpUtility.UrlDecode(lol); Console.WriteLine(lol); string sql = "SELECT BP_UID FROM T_BlogPost ORDER BY BP_EntryDate DESC" + this.m_fac.PagingTemplate(1); using (System.Data.Common.DbConnection con = this.m_fac.Connection) { id = con.QuerySingle <string>(sql); } sql = "SELECT * FROM T_BlogPost WHERE BP_UID = @__bp_uid"; using (System.Data.Common.DbConnection con = this.m_fac.Connection) { bp = con.QuerySingle <T_BlogPost>(sql, new { __bp_uid = new System.Guid(id) }); } bp.BP_Content = ReplaceURLs(bp.BP_Content); // http://stackoverflow.com/questions/16389234/create-dropdown-with-predefined-values-in-asp-net-mvc-3-using-razor-view/16389278#16389278 ViewData["myList"] = new SelectList(new[] { "10", "15", "25", "50", "100", "1000" } .Select(x => new { value = x, text = x }), "value", "text", "15"); List <SelectListItem> ls = new List <SelectListItem>(); ls.Add(new SelectListItem() { Text = "Yes", Value = "true", Selected = true }); ls.Add(new SelectListItem() { Text = "No", Value = "false", Selected = false }); ls.Add(new SelectListItem() { Text = "Not Applicable", Value = "NULL", Selected = false }); ViewData["myList"] = ls; ViewData["myList"] = new[] { "10", "15", "25", "50", "100", "1000" } .Select(x => new SelectListItem { Selected = x == "25", Text = x, Value = x }); ViewData["myList"] = new SelectList(new[] { "10", "15", "25", "50", "100", "1000" } .Select(x => new SelectListItem { Value = x, Text = x }), "Value", "Text", "15"); ViewData["myList"] = from c in new[] { "10", "15", "25", "50", "100", "1000" } select new SelectListItem { Selected = (c == "25"), Text = c, Value = c }; return(View(bp)); } // End Action ShowEntry