SymbolsController.cs
1.04 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using CWA.CpoOnline.Helpers;
using CWA.CpoOnline.Models;
namespace CWA.CpoOnline.Controllers
{
[Authorize(Roles = CpoRoles.Admin)]
public class SymbolsController : Controller
{
public ActionResult Index(string id="0")
{
ViewBag.ActiveSectorId = id;
List<SectorViewModel> sectors;
if (string.IsNullOrWhiteSpace(id) || id.Equals("0"))
{
sectors = HardCode.AllSectors;
}
else
{
sectors = HardCode.AllSectors.Where(s => s.Id.Equals(id, StringComparison.InvariantCultureIgnoreCase)).OrderBy(s => s.Name).ToList();
}
var symbols = sectors.SelectMany(sector => sector.Symbols).ToList();
ViewBag.AllSymbols = symbols;
return View(HardCode.AllSectors);
}
public ActionResult Add()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public async Task<ActionResult> Delete(string id)
{
return RedirectToAction("index");
}
}
}