Skip to content

Commit b2df146

Browse files
committed
Sorting search
1 parent d2e8c95 commit b2df146

12 files changed

+2
-2
lines changed

EPAM.MyBlog.DAL.DB/DAL.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ public bool AddAvatar(Entities.Avatar avatar)
729729
{
730730
using (SqlConnection con = new SqlConnection(ConnectionString))
731731
{
732-
SqlCommand command = new SqlCommand("SELECT [Blog].dbo.Posts.Post_Id,[Blog].dbo.Posts.Post_Title FROM [Blog].dbo.Posts INNER JOIN [Blog].dbo.Tags ON [Blog].dbo.Tags.Post_Id = [Blog].dbo.Posts.Post_Id WHERE Tag LIKE @Tag", con);
732+
SqlCommand command = new SqlCommand("SELECT [Blog].dbo.Posts.Post_Id,[Blog].dbo.Posts.Post_Title FROM [Blog].dbo.Posts INNER JOIN [Blog].dbo.Tags ON [Blog].dbo.Tags.Post_Id = [Blog].dbo.Posts.Post_Id WHERE Tag LIKE @Tag ORDER BY [Blog].dbo.Posts.Time DESC", con);
733733
command.Parameters.Add(new SqlParameter("@Tag", p));
734734
con.Open();
735735
var reader = command.ExecuteReader();
@@ -751,7 +751,7 @@ public bool AddAvatar(Entities.Avatar avatar)
751751
{
752752
using (SqlConnection con = new SqlConnection(ConnectionString))
753753
{
754-
SqlCommand command = new SqlCommand("SELECT [Post_Id], [Post_Title] FROM [Blog].dbo.Posts WHERE Post_Text LIKE @Text", con);
754+
SqlCommand command = new SqlCommand("SELECT [Post_Id], [Post_Title] FROM [Blog].dbo.Posts WHERE Post_Text LIKE @Text ORDER BY [Blog].dbo.Posts.Time DESC", con);
755755
command.Parameters.Add(new SqlParameter("@Text", p));
756756
con.Open();
757757
var reader = command.ExecuteReader();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)