hello ,
i had made two table as below
SELECT TOP 1000 [id]
,[Datetpublish]
,[statusid]
,[Title]
,[Author]
,[Content1]
FROM [blogstatus].[dbo].[Blogstatus]
SELECT TOP 1000 [statusid]
,[blogstatusname]
FROM [blogstatus].[dbo].[statusname]
in Index controller page
using (ctx = new blogstatusEntities1())
{
var publish = (from d in ctx.Blogstatus
join m in ctx.statusnames on d.statusid equals m.statusid
where m.statusid == 1
select new
{
id = d.id,
Datetpublish = d.Datetpublish,
Title = d.Title,
Author = d.Author,
Content1 = d.Content1
}).ToList();
return View(publish);
}
in view page
@using blogwithstatus.Models
@{
ViewBag.Title = "Index";
}
Blog news
list of blog
@using (var ctx = new blogstatusEntities1())
{
foreach (var blog in ctx.Blogstatus)
{
@blog.Title
Author| @blog.Author
have u check my query in controller ? and i did wrong any query? please fix these query with ef
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
sonal malhotraPosted Jan 3, 2019, 3:55 AM
Piyush PansuriyaPosted Jan 3, 2019, 2:11 AM
Hello,
First check in controller, put break point here : return View(publish);
Is it returns data in publish or not?
Than, in your view page
sonal malhotraPosted Jan 3, 2019, 1:59 AM
Piyush PansuriyaPosted Jan 3, 2019, 1:39 AM