c# - Cannot get Controller to build model form query and parameter passed in - multiple models to get data -
I have 4 simple models in a larger model. I am using here and doing a complex query with the result set. I am works great. I have a parameter that has been passed to complete the update in a new table comprised of all the parts.
Then, in the controller, the required antial (passed parameter) comes from the expected action on the expected final visual data query.
I have created other functions with a model, No problem.
I have tried to create a new model and then get a blank reference error on the particular by adding the model and I assume the model: (object tap reference error) code is not currently there Is:
var model = new AddCompToEventClass (); Model Compediter. Compisitoriid = compadrate;
I can not understand how to get everything in the model to go to the next scene.
Controller code: compeditorId commented. The expected computitid parameter passes for the controller.
Public Functionality AddCompToEventClass (Int Compatritized) {// ?? Model Compediter. Compisitoriid = compatricid; On the above model = _db.Events o o.EventID on _db.Event_Classes is equal to o2 joining o2.EventID where o.EventID.Equals (o2.EventID) o2.ClassID on _db.Class_Definitions in O3 Joining is o3.Class_Definition_ID where o2 .classID.Equals (o3.Class_Definition_ID) where o.CurrentEvent.Equals (correct) New AddCompToEventClass selection {event = o, Event_Class = O2, Class_Definition = o3}; See Return (Model);
Model here (based on 4 other models)
Namespace eManager.Web2.Models {Public category AddCompToEventClass {Public Compeditor Compeditor {get; Set; } Public Event Event {Received; Set; } Public Event_Class Event_Class {get; Set; } Public class definition class definition {get; Set; }}}
Updated code: Now I get the competitor and question, but only the query has been sent to the model ... In the questioner I get the link exception with the competitor < / P> I get an empty reference error on the int for model value : (Object tap reference error) You are easily missing another constructor: From o_db.Events to o.EventID on _db.Event_Classes equals joining in o2 o2.EventID where o.EventID.Equals (o2.EventID ) O2.ClassID is equivalent to joining O3 in _db.Class_Definitions o3.Class_Definition_ID where o2.ClassID. Equal (o3.Class_Definition_ID) where o.CurrentEvent.Equals (correct) select new AddCompToEventClass {event = o, Event_Class = o2, Class_Definition = o3,}; Model Compeditor = new compatitor (CompeditorId = compeditorid;) Return view (model);} Public Activity AddCompToEventClass (Int Compatritid) {var Compressor = New Compatitor (); Compeditor.CompeditorId = compeditorid; On the above model = _db.Events o o.EventID on _db.Event_Classes is equal to o2 joining o2.EventID where o.EventID.Equals (o2.EventID) o2.ClassID on _db.Class_Definitions in O3 Joining is o3.Class_Definition_ID where o2 .classID.Equals (o3.Class_Definition_ID) where o.CurrentEvent.Equals (correct) select new AddCompToEventClass {event = o, Event_Class = o2, Class_Definition = o3}; See Return (Model); }
var model = new AddCompToEventClass (); // Model The compiler is the most faucet model. Compediter = new compact (); Model Compediter. Compisitoriid = compadrate;
Comments
Post a Comment