Skip to content

Commit 8564a29

Browse files
committed
View with avatar
1 parent 0943d14 commit 8564a29

File tree

10 files changed

+38
-9
lines changed

10 files changed

+38
-9
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,7 @@ public ActionResult DeleteAc(ConfirmModel model)
168168

169169
public ActionResult Avatar()
170170
{
171-
172171
var info = AvatarModel.GetInfo(User.Identity.Name);
173-
ViewData["path"] = "~/Content/img/" + User.Identity.Name + ".jpg";
174-
var file = File(info.Avatar, info.MimeType, User.Identity.Name + ".jpg");
175-
176172
return PartialView(info);
177173
}
178174

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,21 @@ public ActionResult DeleteComment(Guid id, ConfirmModel model, string ReturnUrl)
131131
}
132132
return View();
133133
}
134+
135+
//[HttpPost]
136+
//public ActionResult ChangeUser()
137+
//{
138+
// string exist;
139+
140+
141+
// for (int i = 0; i < length; i++)
142+
// {
143+
// exist = Request[i.ToString()];
144+
// if (exist == "on")
145+
// {
146+
// UserModel.AddLink(idUser, ChooseAwardsModel.awards[i].AwardId);
147+
// }
148+
// }
149+
//}
134150
}
135151
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,18 @@ public ActionResult EditInfoAvatar(HttpPostedFileBase File)
4444
return View();
4545

4646
}
47+
48+
public FileContentResult GetImage(string name)
49+
{
50+
if (name != null)
51+
{
52+
var info = AvatarModel.GetInfo(name);
53+
return File(info.Avatar, info.MimeType);
54+
}
55+
else
56+
{
57+
return null;
58+
}
59+
}
4760
}
4861
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@model EPAM.MyBlog.UI.Web.Models.AvatarModel
22

3-
<fieldset>
4-
<legend>@Model.Login</legend>
3+
4+
<p>@Model.Login</p>
55

66
@if (Model.Avatar == null)
77
{
@@ -12,11 +12,10 @@
1212
else
1313
{
1414
<div>
15-
<img src="~/Content/img/User-icon.png">
15+
<img src="@Url.Action("GetImage","Files", new { name = User.Identity.Name})" width="250" />
1616
</div>
1717
}
1818

19-
</fieldset>
2019

2120
<div>
2221
@Html.ActionLink("Изменить аватар", "EditInfoAvatar", "Files", null, new { @class="btn btn-default"})

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@Html.ActionLink("Create New", "Create")
55
</p>
66

7-
7+
<form action="@Url.Action("ChangeUser")">
88
<table class="table table-condensed">
99
<tr>
1010
<th>
@@ -42,3 +42,8 @@
4242
}
4343
</tbody>
4444
</table>
45+
<input type="submit" class="btn btn-success" value="Сделать User'ом" id="addUser"/>
46+
<input type="submit" class="btn btn-success" value="Сделать Moder'ом" id="addModer"/>
47+
<input type="submit" class="btn btn-success" value="Сделать Admin'ом" id="addAdmin"/>
48+
<input type="submit" class="btn btn-success" value="Удалить" id="Delete"/>
49+
</form>
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

EPAM.MyBlog.v11.suo

2.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)