Hi All,
I asked a question about passing a list from a class with help I was able to get that to work
https://learn.microsoft.com/en-us/answers/questions/1275797/i-am-trying-to-return-an-entity-framework-list-in?page=1&orderby=helpful&comment=answer-1245226#newest-answer-comment
But now on the MVC side of things... everything has gone out of shape and I can even use the data that I passed in because the view in the mvc program expects something call and ienumrable version of my table but its complaining that it is getting a version of that table from my class. (this kinda of thing makes me want to put a bullet in my head)
So I have read up on things and I thought I could use the trick of making that clone of the table and then reading my results into that clone it was a no go.
I mean seriously what am I missing? of course If I make a list using a class library surely the computer know that I am trying to feed it into a view... why would it try using the version from the class library and not allow me to tell it that I want to take that data from the class library and fit it into the local clone of the database table for the view?
I am so confused now.
When I try this
IEnumerable DocList = DSDB_Library.GET_DOCUMENTS_BY_DocCode(DocCode);
public ActionResult Gate(string DocCode)
{
DSDBEntities DB_Entities = new DSDBEntities();
var DSDB_Library = new DSDB_LIBRARY.DBDS_ClassV1();
IEnumerable DocList = DSDB_Library.GET_DOCUMENTS_BY_DocCode(DocCode);
//var DocList = DB_Entities.DSDB_STORE_TBL.Where(d => d.DOC_SOURCE_DISC == DocCode).ToList();
return View(DocList);
//return View(DB_Entities.DSDB_STORE_TBL.ToList().Find(d =>d.DOC_SOURCE_DISC == DocCode));
}
it compiles but I get this error
The model item passed into the dictionary is of type 'System.Collections.Generic.List1[DSDB_LIBRARY.Models.DSDB_STORE_TBL]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1[DSDB_V1.Models.DSDB_STORE_TBL]'.
my source I tried:
[HttpPost]
public ActionResult Gate(string DocCode)
{
DSDBEntities DB_Entities = new DSDBEntities();
var DSDB_Library = new DSDB_LIBRARY.DBDS_ClassV1();
IEnumerable<DSDB_STORE_TBL> Test = new IEnumerable<DSDB_STORE_TBL>();
IEnumerable DocList = DSDB_Library.GET_DOCUMENTS_BY_DocCode(DocCode);
//var DocList = DB_Entities.DSDB_STORE_TBL.Where(d => d.DOC_SOURCE_DISC == DocCode).ToList();
return View(DocList);
//return View(DB_Entities.DSDB_STORE_TBL.ToList().Find(d =>d.DOC_SOURCE_DISC == DocCode));
}
I added this thinking I could make a close of my table and then read in the filtered values. But that give this error.
Cannot create an instance of the abstract class or interface 'IEnumerable<DSDB_STORE_TBL>' DSDB-V1 C:\APP_DEV\DSDB_DOCUMENT_STORAGE\DSDB-V1\DSDB-V1\Controllers\SSDMController.cs 102 Active
Of course I can find anything saying why this happened