How can i update and at the same time how can i insert of two different modelsi am developing a project called "CarPaarking application" so need a help. i have written code for displaying parkid's as a link, here if any user clicks on parkid link it will redirect to
"/car/create/?parkid" so here user car details will be saved and at same time the pakid status should be active that means user car was parked and when user exit from parking the parkid status should be inactive. how could i write the code.
HERE MY CONTROLLER CODE:
public ActionResult Create(string areaname, int pid)
var cars = new Tuple<Area, Place>(db.Areas.FirstOrDefault(a => a.ParkingPlaceName == areaname), db.Places.FirstOrDefault(p => p.ParkID == pid));
// POST: Car/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
public ActionResult Create([Bind(Include = "CarID,AreaID,ParkID,PlaceId,CarNumber,MobileNumber,ParkedTime,Charges,ParkingLeftTime,TotalParkingTime,Status")] Car car, int pid)
var pla = db.Places.FirstOrDefault(a => a.ParkID == pid);
var place = (from pl in db.Places
where pl.ParkID == pid
place.PlaceId_Status = true;
db.Entry(place).State = EntityState.Modified;