@model Models.User

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Create user with Repository</title>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
    <script src="@Url.Content("~/Scripts/modernizr-2.6.2.js")"></script>

    <style type="text/css">
        .form-wrapper {
            width: 700px;
            font-family: Tahoma;
            font-size: 11px;
            direction: ltr;
            margin: 5px auto 0px auto;
            background-color: #EFEFEF;
            padding: 6px;
            text-align: left;
            border-radius: 7px;
            -moz-border-radius: 7px;
            -webkit-border-radius: 7px;
        }
    </style>

</head>
<body>

    <section id="Form-Section">

        <div class="form-wrapper">
            <h4>
                Learn Repository Pattern
            </h4>
            Repository Pattern in ASP.net MVC4 with EF codefirst 5


        </div>


        @using (Html.BeginForm("CreateUser", "Home", FormMethod.Post))
        {
        
            @Html.ValidationSummary(true)
        
            <div class="form-wrapper">

                <fieldset>

                    <legend>
                        Create user
                    </legend>


                    <div>
                        @Html.LabelFor(Model => Model.FirstName)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.FirstName)
                        @Html.ValidationMessageFor(Model => Model.FirstName)
                    </div>

                    <div>
                        @Html.LabelFor(Model => Model.LastName)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.LastName)
                        @Html.ValidationMessageFor(Model => Model.LastName)
                    </div>

                    <div>
                        @Html.LabelFor(Model => Model.Username)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.Username)
                        @Html.ValidationMessageFor(Model => Model.Username)
                    </div>


                    <div>
                        @Html.LabelFor(Model => Model.Password)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.Password)
                        @Html.ValidationMessageFor(Model => Model.Password)
                    </div>

                    <div>
                        @Html.LabelFor(Model => Model.Role)
                    </div>

                    <div>

                        @{
            var list = new[] {   
                        new infrastructure.Roles { Id = 1, Name = "Administrator" }, 
                        new infrastructure.Roles { Id = 2, Name = "User" }, 
                    };

            var selectList = new SelectList(list, "Name", "Name", 1);
                        }

                        @Html.DropDownList("Role", selectList)
                    </div>


                    <div>
                        @Html.LabelFor(Model => Model.Email)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.Email)
                        @Html.ValidationMessageFor(Model => Model.Email)
                    </div>

                    <div>
                        @Html.LabelFor(Model => Model.Avatar)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.Avatar)
                        @Html.ValidationMessageFor(Model => Model.Avatar)
                    </div>

                    <div>
                        @Html.LabelFor(Model => Model.isActive)
                    </div>

                    <div>
                        @Html.EditorFor(Model => Model.isActive)
                        @Html.ValidationMessageFor(Model => Model.isActive)
                    </div>


                    <input type="submit" name="btn" id="btn" value="Create user" />

                </fieldset>

            </div>
        }

        <div class="form-wrapper" style="text-align:center ">
            @Html.ActionLink("Show Users", "ShowUser")
        </div>

        <div class="form-wrapper" style="text-align:center ">
            Develop By
            <strong>Hamidreza Pahlavan</strong>
            <br />
            Contact: info@crystalweb.ir
        </div>

    </section>

</body>
</html>
