public ActionResult Create(Models.Symbol symbol, HttpPostedFileBase uploadFile, string[] packages) { ViewBag.Themes = new SelectList(CodeList.Themes(), "Key", "Value", symbol.Theme); ViewBag.SymbolPackages = new SelectList(_symbolService.GetPackagesWithAccessControl(), "SystemId", "Name"); symbol.SymbolPackages = new List <SymbolPackage>(); if (packages != null) { foreach (var package in packages) { symbol.SymbolPackages.Add(_symbolService.GetPackage(Guid.Parse(package))); } } ViewBag.IsAdmin = false; if (Request.IsAuthenticated) { ViewBag.IsAdmin = _authorizationService.IsAdmin(); } if (ModelState.IsValid) { ImageService img = new ImageService(); if (uploadFile != null) { symbol.Thumbnail = img.SaveThumbnail(uploadFile, symbol); } var addedSymbol = _symbolService.AddSymbol(symbol); return(RedirectToAction("Details", "Files", new { systemid = addedSymbol.SystemId })); } return(View(symbol)); }
// GET: SymbolPackages/Details/5 public ActionResult Details(Guid?systemid, string sortOrder) { if (systemid == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SymbolPackage symbolPackage = _symbolService.GetPackage(systemid.Value); if (symbolPackage == null) { return(HttpNotFound()); } switch (sortOrder) { case "symbolname_desc": symbolPackage.Symbols = symbolPackage.Symbols.OrderByDescending(s => s.Name).ToList(); break; case "owner": symbolPackage.Symbols = symbolPackage.Symbols.OrderBy(s => s.Owner).ToList(); break; case "owner_desc": symbolPackage.Symbols = symbolPackage.Symbols.OrderByDescending(s => s.Owner).ToList(); break; case "theme_desc": symbolPackage.Symbols = symbolPackage.Symbols.OrderByDescending(s => s.Theme).ToList(); break; case "theme": symbolPackage.Symbols = symbolPackage.Symbols.OrderBy(s => s.Theme).ToList(); break; default: symbolPackage.Symbols = symbolPackage.Symbols.OrderBy(s => s.Name).ToList(); break; } if (string.IsNullOrEmpty(sortOrder)) { sortOrder = "symbolname"; } ViewBag.SymbolnameSortParm = sortOrder == "symbolname" ? "symbolname_desc" : "symbolname"; ViewBag.Owner = sortOrder == "owner" ? "owner_desc" : "owner"; ViewBag.Theme = sortOrder == "theme" ? "theme_desc" : "theme"; ViewBag.SortOrder = sortOrder; return(View(symbolPackage)); }