Beispiel #1
0
 public HttpResponseMessage HelloWorld()
 {
     try
     {
          var tc = new ItemController();
          var defaultvalue=tc.GetItems().First();
          return Request.CreateResponse(HttpStatusCode.OK, defaultvalue.HelloText);
     }
     catch (System.Exception ex)
     {
         //Log to DotNetNuke and reply with Error
         Exceptions.LogException(ex);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
     }
 }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var tc = new ItemController();
         rptItemList.DataSource = tc.GetItems();
         rptItemList.DataBind();
     }
     catch (Exception exc) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }