using System;
using System.ComponentModel.DataAnnotations;
using System.Web;
namespace HelloWorldMvcApp
{
public enum Test
A,
B,
C
}
@model string
@{
var typEnum = ViewData["klucz"] as HelloWorldMvcApp.Test?;
@if(typEnum.HasValue)
<text>Ma wartość na widoku:</text>
<text>@typEnum</text>
<br/>
@Html.ActionLink("Link", "About", "Home", new { input = typEnum })
using System.Web.Mvc;
using System.Collections.Generic;
public class HomeController : Controller
[HttpGet]
public ActionResult Index()
ViewData["klucz"] = Test.B;
return View();
public string About(Test? input)
return input.HasValue ? "has value" : "null";