Initial commit
This commit is contained in:
30
Proyecto/index.aspx.cs
Executable file
30
Proyecto/index.aspx.cs
Executable file
@@ -0,0 +1,30 @@
|
||||
using DAL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using HeyRed.MarkdownSharp;
|
||||
|
||||
public partial class index : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Entities entities = new Entities();
|
||||
|
||||
List<Post> posts;
|
||||
string query = Request.QueryString["query"];
|
||||
if ( query == null )
|
||||
{
|
||||
posts = entities.Posts.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
posts = (from p in entities.Posts where p.title.Contains(query) || p.user.username.Contains(query) || p.markdown.Contains(query) select p).ToList();
|
||||
|
||||
}
|
||||
post_repeater.DataSource = posts ;
|
||||
post_repeater.DataBind();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user