Пример #1
0
        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"];

                using (System.Data.Common.DbConnection con = this.m_fac.Connection)
                {
                    con.Insert <T_BlogPost>(bp);
                } // End Using con

                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
Пример #2
0
        } // End Action Search

        // Content(strHTML, "text/html");


        public void UpdateBlogStructure(System.Collections.Generic.IEnumerable <T_BlogPost> lsBlogEntries)
        {
            T_BlogPost bp;

            using (System.Data.Common.DbConnection con = this.m_fac.Connection)
            {
                foreach (T_BlogPost bpThisPost in lsBlogEntries)
                {
                    bp = bpThisPost;
                    string strHTML = ReplaceURLs(bp.BP_Content);

                    strHTML = strHTML.Replace("\r\n", "\n");
                    strHTML = strHTML.Replace("\n", "<br />");

                    bp.BP_HtmlContent = strHTML;

                    con.Insert <T_BlogPost>(bp);
                } // next bpThisPost
            }     // End Using con
        }         // End Sub UpdateBlogStructure
Пример #3
0
        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_Content = taBody;   // Request.Params["taBody"];

                using (System.Data.Common.DbConnection con = this.m_fac.Connection)
                {
                    con.Insert <T_BlogPost>(bp);
                } // End Using con

                return(RedirectToAction("Success"));
            }
            catch (System.Exception ex)
            {
                // return View();
                return(Json(new { success = false, responseText = ex.Message, stackTrace = ex.StackTrace }));
            }
        } // End Action AddEntry
Пример #4
0
 public void create(Result result)
 {
     // Create a log entry
     result.logTime = DateTime.Now;
     conn.Insert <Result>(result);
 }