30 lines
821 B
C#
Executable File
30 lines
821 B
C#
Executable File
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();
|
|
}
|
|
} |