public static string AddField(string Field, string Data, string Program, string Section, string cont, string[] options) { DBFunctions db = new DBFunctions(); Forms_tbl form = new Forms_tbl { Field = Field, DataType = Data, ProgramID = int.Parse(Program), SectionID = int.Parse(Section), FormControl = cont }; db.addFormField(form,options); return "done"; }
public static string AddField(string Field, string Data, string Program, string Section, string cont, string[] options) { DBFunctions db = new DBFunctions(); Forms_tbl form = new Forms_tbl { Field = Field, DataType = Data, ProgramID = int.Parse(Program), SectionID = int.Parse(Section), FormControl = cont }; db.addFormField(form, options); return("done"); }
public void addFormField(Forms_tbl form,string [] options) { using (db = new CollegeERPDBEntities()) { db.Forms_tbl.Add(form); db.SaveChanges(); if(form.FormControl!="Text") { foreach (string option in options) db.ControlOptions_tbl.Add(new ControlOptions_tbl { FieldID=form.ID,optionvalue=option}); } db.SaveChanges(); } }