c# - Call a database table header with a variable inside it -
i have page update user has written in text fields; text fields values sent database.
however variable names similar:
[httppost] public actionresult tracking(mpb machinerecord, string command) { loadboards(); var currentmachine = db.mpbs.firstordefault(m => m.machine == machinerecord.machine); if (command == "updaterecord") { currentmachine.board = machinerecord.board; currentmachine.machinestatus = machinerecord.machinestatus; currentmachine.hour1_goal = machinerecord.hour1_goal; currentmachine.hour1_actual = machinerecord.hour1_actual; currentmachine.hour1_scrap = machinerecord.hour1_scrap; currentmachine.hour1_downtime = machinerecord.hour1_downtime; currentmachine.hour1_rework = machinerecord.hour1_rework; currentmachine.hour1_comments = machinerecord.hour1_comments; currentmachine.hour2_goal = machinerecord.hour2_goal; currentmachine.hour2_actual = machinerecord.hour2_actual; currentmachine.hour2_scrap = machinerecord.hour2_scrap; currentmachine.hour2_downtime = machinerecord.hour2_downtime; currentmachine.hour2_rework = machinerecord.hour2_rework; currentmachine.hour2_comments = machinerecord.hour2_comments; ... } ... } this continues on 8 hours, database made beforehand , unable change how structured. can see, each currentmachine.hourx or machinerecord.hourx there way can replace x variable can loop update fields database?
Comments
Post a Comment