protected void btnGuardar_Click(object sender, EventArgs e) { string idstr = boxID.Text; Debug.WriteLine("ID AL wardar: " + idstr); try { if (String.IsNullOrEmpty(idstr)) //new { Message msg = new Message(); msg.Name = boxNombre.Text; msg.Email = boxEmail.Text; msg.Subject = boxAsunto.Text; msg.Content = boxContenido.InnerText; MessageDAO.AddMessage(msg); } else //update { Message msg = new Message(); msg.Id = int.Parse(idstr); msg.Name = boxNombre.Text; msg.Email = boxEmail.Text; msg.Subject = boxAsunto.Text; msg.Content = boxContenido.InnerText; MessageDAO.ModMessage(msg); } } catch (Exception ex) { Debug.WriteLine(ex.StackTrace); Debug.WriteLine(ex.Message); } Response.Redirect("~/MessageList"); Context.ApplicationInstance.CompleteRequest(); }