ChartController.cs
1.93 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using CWA.CpoOnline.Helpers;
namespace CWA.CpoOnline.Controllers
{
[Authorize]
public class ChartController : Controller
{
// GET: Chart
public ActionResult Index()
{
return View();
}
public ActionResult One()
{
return View("index");
}
public ActionResult Two()
{
return View();
}
[HttpPost]
[AllowAnonymous]
public ActionResult SaveImage(HttpPostedFileBase file)
{
if (file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Content/charts"), fileName);
file.SaveAs(path);
}
return RedirectToAction("Index");
}
public ActionResult WideModeToggle()
{
CurrentUser.Settings.IsWideMode = !CurrentUser.Settings.IsWideMode;
var returnUrl = Request?.UrlReferrer?.PathAndQuery;
return RedirectToLocal(returnUrl);
}
public ActionResult Display(string symbol, string layout = "")
{
ViewBag.layout = layout;
foreach (var sector in HardCode.AllSectors)
{
foreach (var symbolI in sector.Symbols)
{
if (symbolI.Symbol == symbol)
{
return View(symbolI);
}
}
}
return View();
}
private ActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
return RedirectToAction("Index", "Home");
}
}
}