The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VaultController.cs 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Teknik.Areas.Vault.Models;
  7. using Teknik.Areas.Vault.ViewModels;
  8. using Teknik.Attributes;
  9. using Teknik.Controllers;
  10. using Teknik.Models;
  11. using Teknik.Utilities;
  12. namespace Teknik.Areas.Vault.Controllers
  13. {
  14. [TeknikAuthorize]
  15. public class VaultController : DefaultController
  16. {
  17. private TeknikEntities db = new TeknikEntities();
  18. [AllowAnonymous]
  19. public ActionResult Create()
  20. {
  21. return View();
  22. }
  23. [AllowAnonymous]
  24. public ActionResult ViewVault(string id)
  25. {
  26. Models.Vault foundVault = db.Vaults.Where(v => v.Url == id).FirstOrDefault();
  27. if (foundVault != null)
  28. {
  29. VaultViewModel model = new VaultViewModel();
  30. model.Url = foundVault.Url;
  31. model.Title = foundVault.Title;
  32. model.Description = foundVault.Description;
  33. model.DateCreated = foundVault.DateCreated;
  34. model.DateEdited = foundVault.DateEdited;
  35. model.Items = foundVault.Items.ToList();
  36. return View(model);
  37. }
  38. return Redirect(Url.SubRouteUrl("error", "Error.Http404"));
  39. }
  40. }
  41. }