Updated gallery and projects controllers
This commit is contained in:
@@ -12,16 +12,13 @@ namespace MyWebsite.Controllers
|
||||
[HttpGet("Arts")]
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
ViewData["Images"] = JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Gallery.json"));
|
||||
|
||||
return View();
|
||||
return View(JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Gallery.json")));
|
||||
}
|
||||
|
||||
[HttpGet("Image")]
|
||||
public async Task<IActionResult> Details(string id)
|
||||
{
|
||||
ViewData["CurrentImage"] = JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"https://{Request.Host}/Gallery.json")).First(i => i.FileName == id);
|
||||
|
||||
return View();
|
||||
return View(JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"https://{Request.Host}/Gallery.json")).First(i => i.FileName == id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = (ViewData["CurrentImage"] as Image).Title;
|
||||
Image image = ViewData["CurrentImage"] as Image;
|
||||
ViewData["Title"] = Model.Title;
|
||||
Image image = Model;
|
||||
}
|
||||
|
||||
<header>
|
||||
@@ -15,7 +15,7 @@
|
||||
<h1>@image.Title</h1>
|
||||
<span>Creation date: @image.CreationDate.ToShortDateString()</span>
|
||||
<p>
|
||||
@foreach(string line in image.Description.Split("<br />"))
|
||||
@foreach(string line in image.Description.Split("\n"))
|
||||
{
|
||||
@line<br />
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</header>
|
||||
|
||||
<article class="info-block gallery">
|
||||
@foreach (Image image in ViewData["Images"] as Image[])
|
||||
@foreach (Image image in Model)
|
||||
{
|
||||
<a asp-action="Details" asp-route-id="@image.FileName"><img title="@image.Title" src="~/images/Gallery/@image.FileName"/></a>
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<div>
|
||||
<h1>@p.Title</h1>
|
||||
<p class="description">
|
||||
@foreach(string line in p.Description.Split("<br />"))
|
||||
@foreach(string line in p.Description.Split("\n"))
|
||||
{
|
||||
@line<br />
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
"FileName": "Cakeday.png",
|
||||
"Title": "Happy cakeday to me!",
|
||||
"CreationDate": "2019-11-06",
|
||||
"Description": "A little doodle I made for my fist year anniversary on Reddit<br />Tools: Adobe Photoshop CC 2019"
|
||||
"Description": "A little doodle I made for my fist year anniversary on Reddit\nTools: Adobe Photoshop CC 2019"
|
||||
}
|
||||
]
|
||||
@@ -1,7 +1,7 @@
|
||||
[
|
||||
{
|
||||
"Title": "FoxTube",
|
||||
"Description": "This is my first big project. And the first one published in Microsoft Store.<br />This is a Windows client application for YouTube",
|
||||
"Description": "This is my first big project. And the first one published in Microsoft Store.\nThis is a Windows client application for YouTube",
|
||||
"ImageName": "FoxTube.png",
|
||||
"Link": "//foxtube.xfox111.net",
|
||||
"LinkCaption": "Learn more...",
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
{
|
||||
"Title": "MotionDecoder",
|
||||
"Description": "This project is used to analyze videos from security cameras and shows short clips which contain detected motions.<br />I made this projects during scientific projects competition in big data division.",
|
||||
"Description": "This project is used to analyze videos from security cameras and shows short clips which contain detected motions.\nI made this projects during scientific projects competition in big data division.",
|
||||
"ImageName": "MotionDecoder.png",
|
||||
"Link": "//github.com/XFox111/motiondecoder",
|
||||
"LinkCaption": "View on GitHub",
|
||||
@@ -77,7 +77,7 @@
|
||||
},
|
||||
{
|
||||
"Title": "GZipCompression",
|
||||
"Description": "Console program which splits files on 1MB blocks and compresses them in multi-thread.<br />I made this program as intro challange in Veeam Software",
|
||||
"Description": "Console program which splits files on 1MB blocks and compresses them in multi-thread.\nI made this program as intro challange in Veeam Software",
|
||||
"ImageName": "",
|
||||
"Link": "https://github.com/XFox111/gzipcompression",
|
||||
"LinkCaption": "View on GitHub",
|
||||
|
||||
Reference in New Issue
Block a user