1
0

Refactoring 1

This commit is contained in:
Michael Gordeev
2019-12-09 21:14:09 +03:00
parent 7f57d9cc95
commit 53e95afa2d
115 changed files with 934 additions and 0 deletions
@@ -0,0 +1,25 @@
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()
{
return View(JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Gallery.json")));
}
[HttpGet("Image")]
public async Task<IActionResult> Details(string id)
{
return View(JsonConvert.DeserializeObject<Image[]>(await new HttpClient().GetStringAsync($"https://{Request.Host}/Gallery.json")).First(i => i.FileName == id));
}
}
}