ajay pandey

ajay pandey

  • NA
  • 83
  • 11.7k

searching in mvc

Jun 11 2015 11:48 PM
Hi,
when i am performing searching in mvc using ado.net entity data model.
then i am unable to find my Model Class on Option.
Please Advice.
Thanks. 

Answers (3)

0
Shuvojit Halder

Shuvojit Halder

  • 0
  • 763
  • 44.6k
Jun 12 2015 4:55 AM
Follow this URL http://www.asp.net/mvc/overview/older-versions-1/models-(data)/displaying-a-table-of-database-data-cs
0
ajay pandey

ajay pandey

  • 0
  • 83
  • 11.7k
Jun 12 2015 2:18 AM
i Have a "Sample" Database. Where I create a Table Like Below.
 
create table tblEmployee
(
ID int identity primary key,
Name nvarchar(50),
Gender nvarchar(50),
Email nvarchar(50)
)
insert into tblEmployee values('Ajay','Male','ajay55@gmail.com')
insert into tblEmployee values('Ravi','Male','ravi78@gmail.com')
insert into tblEmployee values('Akash','Male','akash854@gmail.com')
insert into tblEmployee values('Pooja','FeMale','pooja55@gmail.com')
select * from tblEmployee
 
 
 now Open a asp.net mvc 4 Project.
"MVCDemo" named.
add "Ado.Net Entity Data Model" To "Models" Folder. 
name it"SampleDataModel.edmx" click "Add"
->"Generate From DataBase"-> Next->Save Entity"SampleDBContext" In Web.config file then ->"Next"->
Expand Table "Select Your Table in my Case "tblEmployee"->
and Model Namespace Give "Models"
"Finish'.
Rename table as "Employee" -> save->"Build The Solution" 
Now Add "Home" Controller to Controller Folder.
 "HomeController"->select "MvcController with read/ write actions and views using Entity Framework
-> Now In the Model Class-> "Employee(MVCDemo.Models")
"But I am Not Getting This Model Class"
Thats The Problem. 
 
 
 
0
Shuvojit Halder

Shuvojit Halder

  • 0
  • 763
  • 44.6k
Jun 12 2015 12:54 AM
Tell more details on it..or post some code sample.