Last post Aug 02, 2018 10:31 AM by mgebhard
Aug 02, 2018 10:10 AM|mazhar khan india|LINK
I have below table with data
select * from Table_Card
Sno name status
1 raj Card completed
2 ravi Cards overdue
3 rohan Card due
4 mazhar Cards in progress
Below is select queries
select count(*) from Table_Card where Status="Card completed"
select count(*) from Table_Card where Status="Cards overdue"
select count(*) from Table_Card where Status="Card due"
select count(*) from Table_Card where Status="Cards in progress"
Now I got counts like this:
Card completed: 1
Cards overdue: 1
Card due: 1
Cards in progress: 1
This is my actually dashboard to show after admin login using any sample code or your own code to achieve
Aug 02, 2018 10:31 AM|mgebhard|LINK
This question is too open to answer accurately and it is not clear if you have Code First configured.
I suggest that you set aside time to learn the fundamentals. The Getting Started tutorials are a good place to start. It explains the basics needed to move forward with code first and migrations.
Assuming you already have a Entities created the linq query is very simple.
int count = (from tc in DbContext.Table_Card where tc.Status == "Card completed" select x).Count();
I can't help with the admin View as I cannot see the code. The standard practice is populating a ViewModel in the Controller and passing the ViewModel to a strongly typed View. Use Razor syntax to create the HTML markup. Again these fundamental MVC constructs
are explained in the Getting Started tutorial on this site.