Skip to content

Commit 96401c9

Browse files
committed
list of post to other users
1 parent c368341 commit 96401c9

24 files changed

+131
-44
lines changed

EPAM.MyBlog.UI.Web/Controllers/PostController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,10 @@ public ActionResult News()
160160
var posts = PresentPostModel.GetAllPostsTitle();
161161
return View(posts);
162162
}
163+
164+
public ActionResult UserPosts(string name)
165+
{
166+
return View(PresentPostModel.GetAllPostsTitle(name));
167+
}
163168
}
164169
}

EPAM.MyBlog.UI.Web/EPAM.MyBlog.UI.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@
299299
<Content Include="Views\Search\Tags.cshtml" />
300300
<Content Include="Views\Post\Favorite.cshtml" />
301301
<Content Include="Views\Post\DeleteFavorite.cshtml" />
302+
<Content Include="Views\Post\UserPosts.cshtml" />
302303
</ItemGroup>
303304
<ItemGroup>
304305
<Folder Include="App_Data\" />

EPAM.MyBlog.UI.Web/Models/AvatarModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ namespace EPAM.MyBlog.UI.Web.Models
77
{
88
public class AvatarModel
99
{
10+
/// <summary>
11+
/// Модель для картинки аватара пользователя. Поля логин, байтовое представлене изображения аватара и тип файла
12+
/// </summary>
13+
1014
public string Login { get { return login; } set { login = value; } }
1115
public byte[] Avatar { get { return avatar; } set { avatar = value; } }
1216
public string MimeType { get { return type; } set { type = value; } }

EPAM.MyBlog.UI.Web/Models/CommentModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ namespace EPAM.MyBlog.UI.Web.Models
88
{
99
public class CommentModel
1010
{
11+
/// <summary>
12+
/// Модель для комментариев пользователя. Поля: ID, текст, время, автор и Id Записи
13+
/// </summary>
1114

1215
public static List<CommentModel> Comments;
1316

EPAM.MyBlog.UI.Web/Models/ConfirmModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ namespace EPAM.MyBlog.UI.Web.Models
88
{
99
public class ConfirmModel
1010
{
11+
/// <summary>
12+
/// Модель подтверждения. Свойство Reason используется только при удалении - для записи причины удаления аккаунта
13+
/// </summary>
14+
1115
public bool Confirm { get{return confirm;} set{confirm = value;} }
1216

1317
[Display(Name = "Причина удаления (необязательно для заполнения)")]

EPAM.MyBlog.UI.Web/Models/MyRoleProvider.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ namespace EPAM.MyBlog.UI.Web.Models
88
{
99
public class MyRoleProvider: RoleProvider
1010
{
11+
/// <summary>
12+
/// класс для выдачи ролей пользователям
13+
/// </summary>
14+
/// <returns></returns>
1115

1216
public override string[] GetAllRoles()
1317
{

EPAM.MyBlog.UI.Web/Models/SearchModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ namespace EPAM.MyBlog.UI.Web.Models
77
{
88
public class SearchModel
99
{
10+
/// <summary>
11+
/// Модель для поиска по тегам и тексту
12+
/// </summary>
13+
///
14+
1015
public string SearchText { get { return search; } set { search = value; } }
1116

1217
private string search;

EPAM.MyBlog.UI.Web/Models/UserAboutModel.cs

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace EPAM.MyBlog.UI.Web.Models
1010
{
1111
public class UserAboutModel
1212
{
13+
/// <summary>
14+
/// Модель для информации о пользователе.
15+
/// </summary>
16+
///
17+
1318
public string Login { get { return login; } set { login = value; } }
1419

1520
[Display(Name = "Пол")]
@@ -39,39 +44,12 @@ public static explicit operator UserAboutModel(Entities.UserInfo Info)
3944
return new UserAboutModel() { Login = Info.Login, AboutMe = Info.AboutMe, Birthday = Info.Birthday, Name = Info.Name, Sex = Info.Sex };
4045
}
4146

42-
43-
//public static Image byteArrayToImage(byte[] byteArrayIn)
44-
//{
45-
// MemoryStream ms = new MemoryStream(byteArrayIn);
46-
// Image returnImage = Image.FromStream(ms);
47-
// returnImage.Save("");
48-
// return returnImage;
49-
//}
50-
51-
public void Upload(HttpPostedFile file, string name)
52-
{
53-
//string path = @"~\" + name + @"\";
54-
//if(!Directory.Exists(path))
55-
//{
56-
// Directory.CreateDirectory(path);
57-
//}
58-
//path += @"myAvatar";
59-
//if(File.Exists(path))
60-
//{
61-
// File.Delete(path);
62-
//}
63-
//file.SaveAs(path);
64-
}
65-
66-
6747
public static UserAboutModel GetInfo(string name)
6848
{
6949
var userinfo = (UserAboutModel)GetDAL.dal.GetUserInfo(name);
7050
return userinfo;
7151
}
7252

73-
//MimeType = image.ContentType;
74-
//Data = new byte[image.ContentLength];
7553

7654
internal bool SetSex()
7755
{

EPAM.MyBlog.UI.Web/Models/UserAdminModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ namespace EPAM.MyBlog.UI.Web.Models
77
{
88
public class UserAdminModel
99
{
10+
/// <summary>
11+
/// Модель пользователей для админитстратора и модератора
12+
/// </summary>
13+
///
14+
1015
public string Name { get { return name; } set { name = value; } }
1116
public string Email { get { return email; } set { email = value; } }
1217
public string Role { get { return role; } set { role = value; } }

EPAM.MyBlog.UI.Web/Views/Account/UserInfo.cshtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@
5050

5151
@Html.Action("UserAvatar", new {name = Model.Login})
5252

53+
@if (Model.Login != User.Identity.Name)
54+
{
55+
@Html.ActionLink("Посты", "UserPosts", "Post", new { name=Model.Login }, null)
56+
}

EPAM.MyBlog.UI.Web/Views/Admin/UserComments.cshtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
<h2>UserComments</h2>
88

9-
<p>
10-
@Html.ActionLink("Create New", "Create")
11-
</p>
9+
10+
1211
<table>
1312
<tr>
1413

EPAM.MyBlog.UI.Web/Views/Admin/UserPosts.cshtml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
@model IEnumerable<EPAM.MyBlog.UI.Web.Models.PresentPostModel>
22

3+
@{ int c = 0;}
4+
5+
<div class="row">
6+
<p class="title title-top">Записи</p>
7+
</div>
38
<table>
49

510
@foreach (var item in Model)
611
{
12+
c++;
713
<tr>
814
<td>
915
@Html.ActionLink(@item.Title, "Posts", new { id=item.Id })
@@ -17,4 +23,16 @@
1723

1824
}
1925

20-
</table>
26+
</table>
27+
28+
29+
@if(c==0)
30+
{
31+
<div class="row list">
32+
<div class="col-sm-8 col-md-8 col-lg-8 col-sx-8">
33+
<p> У пользователя нет статей </p>
34+
</div>
35+
</div>
36+
}
37+
38+
@Html.ActionLink("К пользователям", "Users")

EPAM.MyBlog.UI.Web/Views/Admin/Users.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</p>
66
@using (Html.BeginForm("Users", "Admin", FormMethod.Post))
77
{
8-
//<form action="http://github.com/@Url.Action("ChangeUser")">
8+
99
<table class="table table-condensed">
1010
<tr>
1111
<th>

EPAM.MyBlog.UI.Web/Views/Comment/AddComment.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@foreach (var item in (List<EPAM.MyBlog.UI.Web.Models.CommentModel>)ViewData["List"])
1010
{
1111

12-
<div>@item.Author в @item.Time</div>
12+
<div>@Html.ActionLink(item.Author, "UserInfo","Account",new {name = item.Author}, null) в @item.Time</div>
1313
<div>Сказал: @item.Text </div>
1414
}
1515

@@ -20,7 +20,7 @@
2020

2121
<fieldset>
2222

23-
@Html.HiddenFor(model => model.Post_ID, new { @Value = ViewData["ID"] });
23+
@Html.HiddenFor(model => model.Post_ID, new { @Value = ViewData["ID"] })
2424

2525

2626
<div class="editor-label">
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
@model IEnumerable<EPAM.MyBlog.UI.Web.Models.PresentPostModel>
22

3-
3+
@{ int c = 0;}
44

55
@foreach (var item in Model)
66
{
7+
c++;
78
<div class="row list">
89
<div class="col-sm-8 col-md-8 col-lg-8 col-sx-8">
910
@Html.ActionLink(@item.Title, "Posts", new { id=item.Id })
@@ -13,5 +14,14 @@
1314
</div>
1415
</div>
1516

16-
}
17+
}
18+
19+
@if(c==0)
20+
{
21+
<div class="row list">
22+
<div class="col-sm-8 col-md-8 col-lg-8 col-sx-8">
23+
<p> Вы не добавили ни ондой статьи в "Избранное" </p>
24+
</div>
25+
</div>
26+
}
1727

EPAM.MyBlog.UI.Web/Views/Post/MyPosts.cshtml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
@model IEnumerable<EPAM.MyBlog.UI.Web.Models.PresentPostModel>
22

3-
3+
@{int c = 0;}
44

55
@foreach (var item in Model)
66
{
7+
c++;
78
<div class="row list">
89
<div class="col-sm-8 col-md-8 col-lg-8 col-sx-8">
910
@Html.ActionLink(@item.Title, "Posts", new { id=item.Id })
@@ -16,3 +17,11 @@
1617

1718
}
1819

20+
@if(c==0)
21+
{
22+
<div class="row list">
23+
<div class="col-sm-8 col-md-8 col-lg-8 col-sx-8">
24+
<p> Вы не добавили ни ондой статьи </p>
25+
</div>
26+
</div>
27+
}

EPAM.MyBlog.UI.Web/Views/Post/Posts.cshtml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
}
66
@using (Html.BeginForm("Posts", "Post", FormMethod.Post))
77
{
8-
<div class ="row">
9-
<div class="col-md-12 col-sm-12 col-lg-12 col-sx-12 title">@Html.DisplayFor(model => model.Title)</div>
10-
</div>
11-
<div class ="row">
12-
<div class="col-md-12 col-sm-12 col-lg-12 col-sx-12 post">
13-
@Html.DisplayFor(model => model.Text)
8+
<div class ="row">
9+
<div class="col-md-12 col-sm-12 col-lg-12 col-sx-12 title">@Html.DisplayFor(model => model.Title)</div>
10+
</div>
11+
<div class ="row">
12+
<div class="col-md-12 col-sm-12 col-lg-12 col-sx-12 post">
13+
@Html.DisplayFor(model => model.Text)
14+
</div>
1415
</div>
15-
</div>
1616
<div>
1717
<p>Теги: @Html.DisplayFor(model => model.Tags)</p>
1818
</div>
@@ -34,4 +34,9 @@
3434

3535
@Html.Action("AddComment", "Comment", new { Post_Id = Model.Id })
3636

37+
@if(Model.Author == User.Identity.Name){
3738
@Html.ActionLink("К списку", "Index", "Post")
39+
}
40+
else{
41+
@Html.ActionLink("К списку", "UserPosts", "Post", new { name=Model.Author }, null)
42+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@model IEnumerable<EPAM.MyBlog.UI.Web.Models.PresentPostModel>
2+
3+
@{ int c = 0;}
4+
5+
<div class="row">
6+
<p class="title title-top">Записи</p>
7+
</div>
8+
<table>
9+
10+
@foreach (var item in Model)
11+
{
12+
c++;
13+
<tr>
14+
<td>
15+
@Html.ActionLink(@item.Title, "Posts", new { id=item.Id })
16+
17+
</td>
18+
19+
</tr>
20+
21+
}
22+
23+
</table>
24+
25+
26+
@if(c==0)
27+
{
28+
<div class="row list">
29+
<div class="col-sm-8 col-md-8 col-lg-8 col-sx-8">
30+
<p> У пользователя нет статей </p>
31+
</div>
32+
</div>
33+
}
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

EPAM.MyBlog.v11.suo

32.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)