Initial commit

This commit is contained in:
Daniel Cortes
2020-05-22 01:32:58 -04:00
commit 7fbf91f8b1
319 changed files with 285697 additions and 0 deletions

37
Proyecto/crear_post.aspx.cs Executable file
View File

@@ -0,0 +1,37 @@
using DAL;
using HeyRed.MarkdownSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class crear_post : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["user_id"] == null)
{
Response.Redirect("/index.aspx");
return;
}
}
protected void OnCrear(object sender, EventArgs e)
{
Markdown markdown = new Markdown();
Entities entities = new Entities();
Post post = new Post();
post.user_id = Convert.ToInt32(Session["user_id"]);
post.title = title_box.Text.Trim();
post.markdown = markdown_box.Text;
post.html = markdown.Transform(post.markdown);
entities.Posts.Add(post);
entities.SaveChanges();
Response.Redirect("/index.aspx");
}
}