public ActionResult DeleteConfirmed(DeleteRespondent model)
        {
            model.Respondent = db.Respondents.Find(model.DeleteModelID);
            int    tipstaffRecordID = model.Respondent.tipstaffRecordID;
            string controller       = genericFunctions.TypeOfTipstaffRecord(tipstaffRecordID);

            db.Respondents.Remove(model.Respondent);
            db.SaveChanges();
            //get the Audit Event we just created
            string     recDeleted = model.DeleteModelID.ToString();
            AuditEvent AE         = db.AuditEvents.Where(a => a.auditEventDescription.AuditDescription == "Respondent deleted" && a.RecordChanged == recDeleted).OrderByDescending(a => a.EventDate).Take(1).Single();

            //add a deleted reason
            AE.DeletedReasonID = model.DeletedReasonID;
            //and save again
            db.SaveChanges();
            return(RedirectToAction("Details", controller, new { id = tipstaffRecordID }));
        }
        public ActionResult Delete(int id)
        {
            DeleteRespondent model = new DeleteRespondent(id);

            if (model == null)
            {
                ErrorModel errModel = new ErrorModel(2);
                errModel.ErrorMessage  = string.Format("Respondent record: {0} has been deleted, please raise a help desk call if you think this has been deleted in error.", id);
                TempData["ErrorModel"] = errModel;
                return(RedirectToAction("IndexByModel", "Error", new { area = "", model = errModel ?? null }));
            }
            if (model.Respondent.tipstaffRecord.caseStatus.sequence > 3)
            {
                TempData["UID"] = model.Respondent.tipstaffRecord.UniqueRecordID;
                return(RedirectToAction("ClosedFile", "Error"));
            }

            return(View(model));
        }