0% found this document useful (0 votes)
30 views6 pages

Model YourNamespace

Uploaded by

ninebo5075
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views6 pages

Model YourNamespace

Uploaded by

ninebo5075
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

@model YourNamespace.Models.

LoginViewModel

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Login</title>

<!-- CSS styles -->

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
rel="stylesheet" />

<style>

/* Add your custom CSS styles here */

</style>

</head>

<body>

<!-- Navigation bar -->

<nav class="navbar navbar-default">

<div class="container-fluid">

<div class="navbar-header">

<a class="navbar-brand" href="#">Your Website</a>

</div>

@if (User.Identity.IsAuthenticated)

<ul class="nav navbar-nav">

<li><a href="@Url.Action("Details", "Account")">Details</a></li>

<!-- Add other navigation links here -->


</ul>

<p class="navbar-text navbar-right">Hello, @User.Identity.Name!</p>

<p class="navbar-text navbar-right"><a href="@Url.Action("Logout",


"Account")">Logout</a></p>

</div>

</nav>

<!-- Page content -->

@if (!User.Identity.IsAuthenticated)

<div class="container">

<h2>Login</h2>

@if (!string.IsNullOrEmpty(ViewBag.ErrorMessage))

<div class="alert alert-danger">@ViewBag.ErrorMessage</div>

@using (Html.BeginForm("Authenticate", "Account", FormMethod.Post, new { @class = "form-


horizontal" }))

<div class="form-group">

@Html.LabelFor(model => model.Username, htmlAttributes: new { @class = "control-label


col-md-2" })

<div class="col-md-10">

@Html.TextBoxFor(model => model.Username, new { @class = "form-control" })

</div>

</div>
<div class="form-group">

@Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label


col-md-2" })

<div class="col-md-10">

@Html.PasswordFor(model => model.Password, new { @class = "form-control" })

</div>

</div>

<div class="form-group">

<div class="col-md-offset-2 col-md-10">

<button type="submit" class="btn btn-primary">Login</button>

</div>

</div>

</div>

else

<div class="container">

<h2>Details</h2>

<form class="form-horizontal">

<!-- Full Name -->

<div class="form-group">

@Html.LabelFor(model => model.FullName, htmlAttributes: new { @class = "control-label


col-md-2" })

<div class="col-md-10">

@Html.TextBoxFor(model => model.FullName, new { @class = "form-control", required =


"required" })

</div>
</div>

<!-- Phone Number -->

<div class="form-group">

@Html.LabelFor(model => model.PhoneNumber, htmlAttributes: new { @class = "control-


label col-md-2" })

<div class="col-md-10">

@Html.TextBoxFor(model => model.PhoneNumber, new { @class = "form-control", type =


"number", required = "required" })

</div>

</div>

<!-- Age -->

<div class="form-group">

@Html.LabelFor(model => model.Age, htmlAttributes: new { @class = "control-label col-md-


2" })

<div class="col-md-10">

@Html.TextBoxFor(model => model.Age, new { @class = "form-control", type = "number",


required = "required" })

</div>

</div>

<!-- Gender -->

<div class="form-group">

<label class="control-label col-md-2">Gender</label>

<div class="col-md-10">

<label class="radio-inline">@Html.RadioButtonFor(model => model.Gender, "Male")


Male</label>

<label class="radio-inline">@Html.RadioButtonFor(model => model.Gender, "Female")


Female</label>
<label class="radio-inline">@Html.RadioButtonFor(model => model.Gender, "Other")
Other</label>

</div>

</div>

<!-- Submit Button -->

<div class="form-group">

<div class="col-md-offset-2 col-md-10">

<button type="submit" class="btn btn-primary">Submit</button>

</div>

</div>

</form>

<!-- Display entered details -->

@if (Request.HttpMethod == "POST")

<h3>Entered Details:</h3>

<p><strong>Full Name:</strong> @Html.DisplayFor(model => model.FullName)</p>

<p><strong>Phone Number:</strong> @Html.DisplayFor(model => model.PhoneNumber)</p>

<p><strong>Age:</strong> @Html.DisplayFor(model => model.Age)</p>

<p><strong>Gender:</strong> @Html.DisplayFor(model => model.Gender)</p>

</div>

<!-- JavaScript files -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>

</html>

You might also like