From b4ce7c92889cb9f343bb2cc190eb3d7b789745e7 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Sat, 12 Oct 2019 18:22:46 +0300 Subject: [PATCH] Added projects page --- .../Controllers/GalleryController.cs | 1 - .../Controllers/HelloWorldController.cs | 16 ---- .../Controllers/ProjectsController.cs | 20 +++++ MyWebsite/MyWebsite/Models/Project.cs | 17 ++++ .../MyWebsite/Views/Projects/Index.cshtml | 35 ++++++++ .../MyWebsite/Views/Shared/_Layout.cshtml | 2 +- MyWebsite/MyWebsite/wwwroot/Projects.json | 76 ++++++++++++++++++ MyWebsite/MyWebsite/wwwroot/css/Style.css | 51 +++++++++++- .../wwwroot/images/Badges/android.png | Bin 0 -> 4125 bytes .../wwwroot/images/Badges/csharp.png | Bin 0 -> 34573 bytes .../wwwroot/images/Badges/dotnet.png | Bin 0 -> 52689 bytes .../MyWebsite/wwwroot/images/Badges/unity.png | Bin 0 -> 70380 bytes .../wwwroot/images/Badges/windows.png | Bin 0 -> 6292 bytes .../wwwroot/images/Badges/xamarin.png | Bin 0 -> 20701 bytes .../wwwroot/images/Projects/2048.png | Bin 0 -> 4442 bytes .../wwwroot/images/Projects/FoxTube.png | Bin 0 -> 2380590 bytes .../wwwroot/images/Projects/MiSmartAlarm.png | Bin 0 -> 15861 bytes .../wwwroot/images/Projects/MotionDecoder.png | Bin 0 -> 28744 bytes MyWebsite/MyWebsite/wwwroot/js/site.js | 49 ++++++++++- 19 files changed, 246 insertions(+), 21 deletions(-) delete mode 100644 MyWebsite/MyWebsite/Controllers/HelloWorldController.cs create mode 100644 MyWebsite/MyWebsite/Controllers/ProjectsController.cs create mode 100644 MyWebsite/MyWebsite/Models/Project.cs create mode 100644 MyWebsite/MyWebsite/Views/Projects/Index.cshtml create mode 100644 MyWebsite/MyWebsite/wwwroot/Projects.json create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Badges/android.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Badges/csharp.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Badges/dotnet.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Badges/unity.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Badges/windows.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Badges/xamarin.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Projects/2048.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Projects/FoxTube.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Projects/MiSmartAlarm.png create mode 100644 MyWebsite/MyWebsite/wwwroot/images/Projects/MotionDecoder.png 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 @@ - +