Step-7

 

Check Web.Config for Database Connection String. Here, add name and nothing but the Autogenerate Database Entity class file name, i.e., "CrystalGranite2016Entities1".

  1. <connectionStrings>  
  2. <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-SatyaprakashMultimodels-20171223092521.mdf;Initial Catalog=aspnet-SatyaprakashMultimodels-20171223092521;Integrated Security=True" providerName="System.Data.SqlClient" />
  3. <add name="CrystalGranite2016Entities1" connectionString="metadata=res://*/Satyadatabasemodel.csdl|res://*/Satyadatabasemodel.ssdl|res://*/Satyadatabasemodel.msl;provider=System.Data.SqlClient;provider connection string="data source=SODN-PAVILION\SQLEXPRESS;initial catalog=CrystalGranite2016;persist security info=True;user id=sa;password=satya;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />  
  4. </connectionStrings> 

Step-8 

In RouteConfig File, I have added Controller name and Action method name for setting the start page.

  1. routes.MapRoute(  
  2.                 name: "Default",  
  3.                 url: "{controller}/{action}/{id}",  
  4.                 defaults: new { controller = "Home", action = "LoginRegister", id = UrlParameter.Optional }  
  5.             );  

OUTPUT

 

The URL is: http://localhost:2546/Home/LoginRegister

 

I created a new user as the below image. But already, a user in our database goes by the same username, Satya.

 

 

So, I tried different names Satyadev. After that, I got a successful message.

 

 

Try for the login part using Satyadev username.

 

 

Check In the database:

 

 

Mobile View

 

 

Summary

  • Use more than one model in one view.
  • MVC with Entity Frameork and Bootstrap.
  • Bootbox library for message display.