using System;
using System.ComponentModel.DataAnnotations;
namespace HelloWorldMvcApp
{
public class UserModel
public int UserId { get; set; }
public string UserName { get; set; }
}
@model HelloWorldMvcApp.UserModel
@{
Layout = null;
<!DOCTYPE html>
<!-- template from http://getbootstrap.com/getting-started -->
<html lang="en">
<head>
</head>
<body>
<div class="container">
<div class="col-md-6 col-md-offset-3">
<form name="UserModel" method="POST" action="/Home/Login">
<div class="field">
<div class="control">
<input class="input" type="text" placeholder="" name="UserId">
</div>
<div class="field is-grouped">
<button class="button is-link">Log In</button>
</form>
</body>
</html>
using System.Web.Mvc;
using System.Collections.Generic;
public class HomeController : Controller
[HttpGet]
public ActionResult Index()
return View();
[HttpPost]
public ActionResult Login(UserModel model)
return View("./Index", model);