protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                // Get the degreeType we want to delete from the combo box
                degreeType = degreeTypes[ddlDegreeTypes.SelectedIndex];
                if (degreeType != null)
                {
                    // Delete from the database
                    degreeType.Delete();

                    //Remove from the list in the UI
                    degreeTypes.Remove(degreeType);

                    // Update Session to this new list
                    Session["degreeTypes"] = degreeTypes;

                    Rebind();
                }
                else
                {
                    throw new Exception("Please pick a Degree Type to delete");
                }
            }
            catch (Exception ex)
            {
                Response.Write("Error: " + ex.Message);
            }
        }
 public ActionResult Delete(int id, DegreeType degreeType)
 {
     try
     {
         // TODO: Add delete logic here
         degreeType.Delete();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(degreeType));
     }
 }
        public void DeleteTest()
        {
            DegreeType degreeType = new DegreeType();

            DegreeTypeList degreeTypes = new DegreeTypeList();

            degreeTypes.Load();

            degreeType = degreeTypes.Where(p => p.Description == "Test Degree Type").FirstOrDefault();

            int result = degreeType.Delete();

            Assert.IsTrue(result > 0);
        }