Hi,Can anybody tell me how to write query to fetch one column value from a table comparing other two column values in that table with other two tables in an MVC Controller?
In my MVC view I need to show 5 column values from one table say POCList and the sixth value(localstock) to be displayed should be fetched from second table say StockMaster which is having matching values in 3rd table Inventorymaster.
public ActionResult GeneratePOC()
{
var generatepoc = db.POCLists.Include(p => p.EmployeeMaster).Include(p => p.POCMaster).Include(p => p.QuoteMaster).Include(p=>p.SKUMaster);
return View(generatepoc.ToList());
}
Any help will be appreciated..Its urget...Thanks in advance.
Jaganathan BantheswaranPosted Jan 10, 2014, 2:44 AM
It is not MVC query or MVC part. Its Entity Framework part.
It is better to use Linq to Entity.
var query = (from pl in db.POCLists
join sm in db.StockMaster on sm.SKU equals pl.SKU
join im in dm.InventoryMaster on im.SKU equals sm.SKU
where sm.LocationId == im.LocationId select new {
SomeProp1 = pl.SomeProp,
SomeProp2 = sm.SomeValue, // six value
}).ToList();
chandu komatiPosted Jul 4, 2016, 8:43 AM
chandu komatiPosted Jul 4, 2016, 8:42 AM
companydetail