Advertisement
gyrospring

✒ 0007.0039 VS2019 VB MVC5 Razor HomeController.vb

Apr 21st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. Public Class HomeController
  2.  
  3.  
  4.  
  5.  
  6. Inherits System.Web.Mvc.Controller
  7.  
  8.  
  9.  
  10.  
  11. Function Index(ByVal Id As String, ByVal Path As String) As ActionResult
  12.  
  13.  
  14. Dim FileName As String = ""
  15. Dim ViewPath As String = ""
  16.  
  17. If Id = "" Then Return View("~/views/home/index.vbhtml")
  18.  
  19. Select Case Id.ToLower
  20.  
  21. Case "about"
  22.  
  23. If Path = "" Then FileName = Id
  24.  
  25. End Select
  26.  
  27. If FileName <> "" Then ViewPath = "~/views/home/" & FileName & ".vbhtml"
  28.  
  29.  
  30. If ViewPath = "" Then
  31.  
  32. Return HttpNotFound()
  33.  
  34. Else
  35.  
  36. Return View(ViewPath)
  37.  
  38. End If
  39.  
  40.  
  41. End Function
  42.  
  43.  
  44.  
  45.  
  46. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement