diff --git a/MyWebsite/MyWebsite/Controllers/GalleryController.cs b/MyWebsite/MyWebsite/Controllers/GalleryController.cs index 2c81523..1eb0910 100644 --- a/MyWebsite/MyWebsite/Controllers/GalleryController.cs +++ b/MyWebsite/MyWebsite/Controllers/GalleryController.cs @@ -9,7 +9,6 @@ namespace MyWebsite.Controllers { public class GalleryController : Controller { - public async Task Index() { ViewData["Images"] = JsonConvert.DeserializeObject(await new HttpClient().GetStringAsync($"https://{Request.Host}/Gallery.json")); diff --git a/MyWebsite/MyWebsite/Controllers/HelloWorldController.cs b/MyWebsite/MyWebsite/Controllers/HelloWorldController.cs deleted file mode 100644 index f459bdd..0000000 --- a/MyWebsite/MyWebsite/Controllers/HelloWorldController.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace MyWebsite.Controllers -{ - public class HelloWorldController : Controller - { - public string Index() - { - return "Hi there, bitch!"; - } - } -} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Controllers/ProjectsController.cs b/MyWebsite/MyWebsite/Controllers/ProjectsController.cs new file mode 100644 index 0000000..b75efbc --- /dev/null +++ b/MyWebsite/MyWebsite/Controllers/ProjectsController.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Mvc; +using MyWebsite.Models; +using Newtonsoft.Json; +using System.Net.Http; +using System.Threading.Tasks; + +namespace MyWebsite.Controllers +{ + public class ProjectsController : Controller + { + public async Task Index() + { + Project[] projects = JsonConvert.DeserializeObject(await new HttpClient().GetStringAsync($"https://{Request.Host}/Projects.json")); + + ViewData["Images"] = projects; + + return View(); + } + } +} \ No newline at end of file diff --git a/MyWebsite/MyWebsite/Models/Project.cs b/MyWebsite/MyWebsite/Models/Project.cs new file mode 100644 index 0000000..21690c6 --- /dev/null +++ b/MyWebsite/MyWebsite/Models/Project.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MyWebsite.Models +{ + public class Project + { + public string Title { get; set; } + public string Description { get; set; } + public string ImageName { get; set; } + public string Link { get; set; } + public string LinkCaption { get; set; } + public string[] Badges { get; set; } + } +} diff --git a/MyWebsite/MyWebsite/Views/Projects/Index.cshtml b/MyWebsite/MyWebsite/Views/Projects/Index.cshtml new file mode 100644 index 0000000..5eaa810 --- /dev/null +++ b/MyWebsite/MyWebsite/Views/Projects/Index.cshtml @@ -0,0 +1,35 @@ + +@{ + ViewData["Title"] = "My projects"; +} + +
+
+

My projects

+

Here is presented the most of projects I worked on

+
+ +
+ +
+ @foreach (Project p in ViewData["Images"] as Project[]) + { +
+ @if (!string.IsNullOrWhiteSpace(p.ImageName)) + { + + } +
+

@p.Title

+

@p.Description

+ @p.LinkCaption +
+ @foreach (string i in p.Badges) + { + + } +
+
+
+ } +
diff --git a/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml b/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml index 4d5dc82..d1faf99 100644 --- a/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml +++ b/MyWebsite/MyWebsite/Views/Shared/_Layout.cshtml @@ -21,7 +21,7 @@ - +