public ActionResult UpdateNow(FormCollection fc) { string code = fc["code"].ToString(); string desc = fc["desc"].ToString(); string status = fc["status"].ToString(); int id2 = Convert.ToInt32(Request.QueryString["id"]); Syllabus_ManagementEntities4 f = new Syllabus_ManagementEntities4(); Core_Value cores = new Core_Value(); var stat = (from u in f.Core_Value where u.name == status select u.coreValue_ID).FirstOrDefault(); var d = f.Program_Educational_Objs.SingleOrDefault(b => b.programEduOutcome_ID == id2); d.objectives = code; d.codeName = code; d.coreValue_FK = stat; f.SaveChanges(); return(RedirectToAction("ProgramObj2", "Chairman")); }
// Chair Create public ActionResult AddCoreValue(FormCollection cv_info) { //retrieve data from URL because passed through form string cv_desc = Convert.ToString(Request.QueryString["cvAttrib"]).Replace(System.Environment.NewLine, "<br />"); string cv_CoreValueName = Convert.ToString(Request.QueryString["cvCoreValue"]); //connect to db Syllabus_ManagementEntities4 syllabus = new Syllabus_ManagementEntities4(); //retrieve table details (firstName, lastName, etc.) Core_Value_Attribute cv_a = new Core_Value_Attribute(); Core_Value cv = new Core_Value(); //find the id base from the selected var core_val = (from u in syllabus.Core_Value where u.name == cv_CoreValueName select u); //assigning the table data through the input using only the FIRST cv_a.coreValue_FK = core_val.First().coreValue_ID; cv_a.description = cv_desc; try { //add data to db syllabus.Core_Value_Attribute.Add(cv_a); //save data to db syllabus.SaveChanges(); } catch (Exception) { } return(RedirectToAction("InstGradAttrb", "InstGradAttrb")); }
// Teacher and Coordinator View public ActionResult InstGradAttrb() { //connect to db Syllabus_ManagementEntities1 syllabus = new Syllabus_ManagementEntities1(); //retrieve table details (firstName, lastName, etc.) -- what table? Core_Value value = new Core_Value(); //from the table friends, select all in descending order by age var core_valueList = (from u in syllabus.Core_Value select u); //converting all the retrieved data (friends) into a list object ViewData["CoreValueList"] = core_valueList.ToList(); return(View()); }