protected void btnUpdate_Click(object sender, EventArgs e) { try { // Get the degreeType we want to update from the combo box degreeType = degreeTypes[ddlDegreeTypes.SelectedIndex]; if (degreeType != null) { // Update from database degreeType.Description = txtDescription.Text; degreeType.Update(); // Put the updated one in the list degreeTypes[ddlDegreeTypes.SelectedIndex] = degreeType; // Update Session to this new list Session["degreeTypes"] = degreeTypes; Rebind(); } else { throw new Exception("Please pick a Degree Type to update"); } } catch (Exception ex) { Response.Write("Error: " + ex.Message); } }
public ActionResult Edit(int id, DegreeType degreeType) { try { // TODO: Add update logic here degreeType.Update(); return(RedirectToAction("Index")); } catch { return(View(degreeType)); } }
public void UpdateTest() { DegreeType degreeType = new DegreeType(); DegreeTypeList degreeTypes = new DegreeTypeList(); degreeTypes.Load(); degreeType = degreeTypes.Where(p => p.Description == "Test Degree Type").FirstOrDefault(); degreeType.Update(); DegreeType updatedDegreeType = new DegreeType(); updatedDegreeType.Id = degreeType.Id; updatedDegreeType.LoadById(); Assert.AreEqual(degreeType.Description, updatedDegreeType.Description); }
public void Put(int id, [FromBody] DegreeType degreetype) { degreetype.Update(); }