Exemple #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var t = new Item();
            var tc = new ItemController();

            if (ItemId > 0)
            {
                t = tc.GetItem(ItemId);
                t.HelloText = txtName.Text.Trim();

            }
            else
            {
                t = new Item()
                {

                    HelloText = txtName.Text.Trim(),

                };
            }

            if (t.TextId > 0)
            {
                tc.UpdateItem(t);
            }
            else
            {
                tc.CreateItem(t);
            }
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
        }
 public HttpResponseMessage UpdateHelloTextByPost(string HelloText)
 {
     try
     {
         var tc = new ItemController();
         var defaultvalue = tc.GetItems().First();
         defaultvalue.HelloText =HelloText;
         tc.UpdateItem(defaultvalue);
         return Request.CreateResponse(HttpStatusCode.OK, "Update successfully");
     }
     catch (System.Exception ex)
     {
         //Log to DotNetNuke and reply with Error
         Exceptions.LogException(ex);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError,"post"+ ex.Message);
     }
 }