Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         BlogPostService _service = new BlogPostService();
         BlogPost        _post    = new BlogPost
         {
             Title       = txtTitle.Value,
             PostContent = txtContent.Value,
             Author      = txtAuthor.Value,
             DatePost    = DateTime.Now
         };
         var result = _service.SavePost(_post);
         if (result)
         {
             ShowMessage("Post creado correctament");
             txtTitle.Value   = string.Empty;
             txtContent.Value = string.Empty;
             txtAuthor.Value  = string.Empty;
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message);
     }
 }