1
0

Repository cleanup, Added art

This commit is contained in:
Michael Gordeev
2019-11-09 12:36:38 +03:00
parent bbcb6b179e
commit 22fb87a132
145 changed files with 16 additions and 14597 deletions
+10
View File
@@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc;
namespace MyWebsite.Controllers
{
public class AboutController : Controller
{
public IActionResult Index() =>
View();
}
}
+28
View File
@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Mvc;
using SelectPdf;
namespace MyWebsite.Controllers
{
public class CVController : Controller
{
public IActionResult Index() =>
View();
public IActionResult Download()
{
HtmlToPdf converter = new HtmlToPdf();
converter.Options.MarginTop = 25;
converter.Options.MarginBottom = 25;
PdfDocument doc = converter.ConvertUrl($"{Request.Scheme}://{Request.Host}/CV/PrintCV?pdfPreview=true");
byte[] data = doc.Save();
doc.Close();
return File(data, "application/pdf", "[Michael Gordeev] CV.pdf");
}
public IActionResult PrintCV(bool pdfPreview = false)
{
ViewData["pdfPreview"] = pdfPreview;
return View();
}
}
}
@@ -0,0 +1,21 @@
using Microsoft.AspNetCore.Mvc;
using MyWebsite.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace MyWebsite.Controllers
{
public class ContactsController : Controller
{
public IActionResult Index()
{
Dictionary<string, Link> links = JsonConvert.DeserializeObject<Dictionary<string, Link>>(new WebClient().DownloadString($"{Request.Scheme}://{Request.Host}/Links.json"));
ViewData["contactLinks"] = links.Values.ToList().FindAll(i => i.CanContactMe);
ViewData["otherLinks"] = links.Values.ToList().FindAll(i => !i.CanContactMe);
return View();
}
}
}
@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Mvc;
using MyWebsite.Models;
using Newtonsoft.Json;
using System.Net.Http;
using System.Linq;
using System.Threading.Tasks;
namespace MyWebsite.Controllers
{
public class GalleryController : Controller
{
[HttpGet("Arts")]
public async Task<IActionResult> Index()
{
ViewData["Images"] = JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Gallery.json"));
return View();
}
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();
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using MyWebsite.Models;
namespace MyWebsite.Controllers
{
public class HomeController : Controller
{
// TODO: Add more specific OpenGraph meta tags
// TODO: Create custom error page
// TODO: Update Projects.json and Gallery.json
// TODO: Complete About page
// TODO: Make language switchable
public IActionResult Index() =>
View();
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() =>
View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
@@ -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<IActionResult> Index()
{
Project[] projects = JsonConvert.DeserializeObject<Project[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Projects.json"));
ViewData["Images"] = projects;
return View();
}
}
}