aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs
blob: ecdbf662cc47be3d87a4bb6dfd2e3530f2ac2f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Tango.MachineService.Filters;
using Tango.MachineService.Models;
using Tango.MachineService.Views.Downloads;

namespace Tango.MachineService.Controllers
{
    public class DownloadsController : Controller
    {
        [Authorize]
        public ActionResult Index()
        {
            List<DownloadModel> downloads = new List<DownloadModel>();
            for (int i = 0; i < 10; i++)
            {
                downloads.Add(new DownloadModel()
                {
                    Name = "Downloads " + i,
                    Comments = "Some comments...\nWith a new line",
                    Date = DateTime.Now.ToString(),
                    User = "Roy",
                    ID = i.ToString(),
                });
            }

            IndexViewModel model = new IndexViewModel();
            model.Downloads = downloads;

            return View(model);
        }

        [Authorize]
        public ActionResult Download(String id)
        {
            return File(new byte[] { 25, 255, 255 }, System.Net.Mime.MediaTypeNames.Application.Octet,"Machine Studio v1.0.exe");
        }
    }
}