Example #1
0
 private bool DeleteRow(Int32 personId)
 {
     bool retval = false;
     using (var db = new CSBCDbContext())
     {
         try
         {
             var rep = new PersonRepository(db);
             if (rep.CanDelete(personId))
             {
                 rep.DeleteById(personId);
                 retval = true;
             }
             else
             {
                 Session["ErrorMSG"] = "Cannot delete person - there may historical player registrations";
             }
         }
         catch (Exception ex)
         {
             Session["ErrorMSG"] = "DeleteRow::" + ex.Message;
         }
     }
     return retval;
 }