Asp.Net Mvc : User Registration Form Using Entity FrameWork And Sql Server

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi all welcome to dr. Bob myself shams here in this video we will discuss how to create user registration form in MVC applications in the previous video we have discussed how to create a user loading page and also some in MVC application so you can combine these two Google names in your upcoming NBC projects to make a complete user login and logout system with user registration form related video links will be there in video description and in the top most common of this video please go through that let me create the efficient VC application for that with file the new project select web and efficacy shaft then a speed or net web application name your application here select the location where you want to see the application and click on ok and select community keep others as it is click on ok that's it we have our fresh brand-new to BC application here let me open my management studio here we have a DB a baby and it contains only one table you sir and its design looks like this it contains four columns because the ID username password and is admin user ID is the primary key for the table identity specification is given for user ID column because of that you don't want to insert values into the column SQL Server will take care of that it will start from 1 then incremented by 1 upon new recording session currently we use establish empty now let me an ad about that entity model of our database into order folder for that right click on model then add new item select data then selected your door Content ID data model name your model here click on that keep it Cassidy's generate from database click on next then click on your connection then specify you ask yourself instance NIMH you just select your DB in my case it is AB DB click on OK then I want to change this name in app config as VB models click on next then select the objects that we need in our entity model in our case we have only one user table so I'm select user click on finish so this is our entity model diagram for user tab so under models you can see you sir class here this is auto-generated by adding a do go to identity model so we will be using this use a plus for our model class purpose now let me add user controller for that right click on controllers then add controller select empty controller name your controller user controller click on air instead of index action we need add or edit action with ID as parameter by default it will be 0 now let me go be renamed space of you subclass into your controller and I'm going to create useful objects inside the action and CEO model and then passing the object interview now we need to create every with name add already for that I click on View and click on add view keep the name as it is select the template as create then selecting model cause as user check the user layout page click on add this is our add or edit view which is created using MVC scaffolding mechanism let me run the application now for that whole Kangol then press f5 so this is how the user registration page looks like and in the you know the code you can see that we have not specified any layout page here so it will take the default layout page as underscore layout CF HTML and here you can see it set the page title from view back door title so here we have passed view back tot title has a door it as Y you can see and or editing the title so first of all we need to change the hand of editing to user registration and then you can see to head the part here when he said already and user instead of that we need only one header h2 header as user registration and then you can see the submit button has quit instead of that and I need it has submit so that you can change the value of the button as submit and finally we have the link as back to this so let's get rid of that let me reload the page now now it looks fine so here we need to add controls for confirm password for that we need to add confirm password property into you circles for that string confirm password and I want to change the display name as display name for this you need to use the using statement system got combined model display name will be confirm space password and I'm going to update the add or edit view for that copying the default password and passing the changing password to confirm password let me build the solution reload the page so here we have the same eye controls for confirm password now we need to add some client-side validation into our user registration form in order to work with a kind set violation we need three scripts file first one is jQuery library itself and then we need daiquiri validate and jQuery validate God and go stream so here we have added daiquiri here in layout page and in the add already we have included a jQuery validate and jQuery while their code and boskie file now we need to specify the validation rules in our user cost before that we need to show the text inside the password and confirm password text box has lots for that you can use data type attribute for that you have to use the namespace system got component model dot that annotation inside the attribute you need to specify that at type as passwords saying for confirm password also now we are going to specify the validation oath first of all we need username as required and then we will enter the error message or message will be shown if the validation phase this field is required sinful password also in case of confirmed password we need compare validator with the exit password for that you can add the attribute come back come back confirm password with password just build the solution we load the page now just try to submit the form without entering any feeds so when you can see the required validation error message shown here with username and password so these validation error messages will be shown you simply raise a code validation message for the property so if I am the admin and password as 1 2 3 and just trying to type 1 2 3 here you can see the validation of my system for password and password to modify and then 1 2 3 it will vanish it as you know this is a HTML form so upon the form submission that as from the form will be sent to form action URL so we need to specify the URL that will handle this or form submission and will be specifying the action and controller here inside the begin form method first parameter will be D action name add or edit then controller name will be used and then deformity that will be posed and with the solution we load the page and try to get the type in fact of this form and then if you check the form tags here you can see the action is use a Doric adage inside the user controller we have one action add already but it is for HTTP GET request not for HTTP POST request so we would another add or edit action for HTTP POST so it will be like public action result hello again then the parameter will be use of objects so that is from the form will be sent to this user object so now we need to save the values from posted form into our user tab for that again just type using DB models that is the name that we have given when we import the ato torrent entity model into our model DB model equals new DB models DB models don't uses add useful model maybe more I don't say changes so here we have saved user details into user table now we will clear phone controls by calling modern shape dot player function and we may set the view back God success message here we will return this old view and/or edit with new user object now we need to update add or edit view in order to show success maceda for that let me copy the d4 submit button and pacing here changing class instead of submit button we need level with class level - success is a class inside bootstrap to show a greenish color to our level view back gone success message build the solution we load the page let me end the some user because here use of 1 p1 as password p1 is administered submit before so here you can see the registration successful message let me check this tab now yes here you can see we have added the utilities into user table finally we are going to prevent duplicate username in user tab for that we need few updates in our add or edit post action for that you can do something like this if DB models dot uses dot any X such that X dot is omega equal to so moral dot is the name if this condition is true it means there is a user with same user name so we will set the view back duplicate duplicate message you certainly already exist so turn the view add or edit then the same user model that is passed from the post method and let me update the add or edit view in order to show the duplicate message for them we can't copied this divorce success message antics as per our need instead of surface message we need duplicate message and instead of success class we need to show the range cloth so it will show in red color with the solution we load the page now try to end at the same username as previous before 1 P 2 P 2 submit the form here you can see the duplicator unless a username already exists so if I change you so want to use a 2 then submit the form here you can see that your session is successful if you check the user table you can see that here that's it guys thank you very much for watching this video tutorial in the previous video we have discussed how to create login page in MVC application than accommodation where is the application and we later videos links will be in video description and in top most common of this video let's go through that please be subscribe to my channel and don't forget to like and share the video with your friends and colleagues so that they can benefit from this have a nice day bye
Info
Channel: CodAffection
Views: 294,839
Rating: undefined out of 5
Keywords: how to create user registration in mvc, create user registration form in mvc, login and registration form in asp.net mvc, creating user registrtion form, user registration with entity framework, user registration page using asp.net mvc, User Registration in Mvc With DataBase, Mvc User Registration With Sql Server, mvc tutorial for beginners, user registration in mvc 5, custom user registration, create login page in mvc, registration form in asp.net mvc with database, CodAffection
Id: xBS9FMF2NFM
Channel Id: undefined
Length: 17min 56sec (1076 seconds)
Published: Thu Mar 02 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.