aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-05-01 00:36:27 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-05-01 00:36:27 +0300
commitd7e74be2ba2a2a69302a25ce394540d8649c7997 (patch)
tree6f24e6e579dd46e7f8fb255bca3186230d27c075 /Software/Visual_Studio/Web/Tango.MachineService/Controllers
parent8336c907a3084b7333e27da3a2ea601dfc4258f2 (diff)
downloadTango-d7e74be2ba2a2a69302a25ce394540d8649c7997.tar.gz
Tango-d7e74be2ba2a2a69302a25ce394540d8649c7997.zip
DefaultUpdatesManager.
FSE Downloads Page on MachineService.
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs60
1 files changed, 60 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs
new file mode 100644
index 000000000..52eb2bbb5
--- /dev/null
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Tango.BL;
+using Tango.MachineService.Filters;
+using Tango.MachineService.Models;
+using Tango.Web.Helpers;
+using System.Data.Entity;
+using Tango.Web.Storage;
+using System.IO;
+using Microsoft.WindowsAzure.Storage.Blob;
+using System.Net.Http;
+using System.Net;
+using System.Net.Http.Headers;
+using System.Net.Mime;
+using Tango.MachineService.Views.FSEDownloads;
+
+namespace Tango.MachineService.Controllers
+{
+ public class FSEDownloadsController : Controller
+ {
+ public ActionResult Index()
+ {
+ IndexViewModel model = new IndexViewModel();
+
+ using (var db = ObservablesContextHelper.CreateContext())
+ {
+ var versions = db.FseVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).Take(6).ToList();
+
+ var manager = new BlobStorageManager();
+ var container = manager.GetContainer(MachineServiceConfig.FSE_VERSIONS_CONTAINER);
+
+ foreach (var item in versions)
+ {
+ var installerBlob = container.GetBlockBlobReference(item.InstallerBlobName);
+
+ model.Downloads.Add(new FSEDownload()
+ {
+ Name = $"Tango FSE v{Version.Parse(item.Version).ToString(3)}",
+ Version = Version.Parse(item.Version).ToString(3),
+ Comments = item.Comments,
+ Date = item.LastUpdated.ToString("dddd, dd MMMM yyyy"),
+ Address = MachineServiceConfig.CDN_ENDPOINT + installerBlob.Uri.AbsolutePath
+ });
+ }
+
+ if (model.Downloads.Count > 0)
+ {
+ var latest = model.Downloads.First();
+ model.Downloads.Remove(latest);
+ model.LatestDownload = latest;
+ }
+ }
+
+ return View(model);
+ }
+ }
+} \ No newline at end of file