コード例 #1
0
        public ActionResult Delete(int id)
        {
            DeleteApplicant model = new DeleteApplicant(id);

            if (model.Applicant == null)
            {
                ErrorModel errModel = new ErrorModel(2);
                errModel.ErrorMessage  = string.Format("Applicant {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 }));
            }
            return(View(model));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(DeleteApplicant model)
        {
            model.Applicant = db.Applicants.Find(model.DeleteModelID);
            int tipstaffRecordID = model.Applicant.tipstaffRecordID;

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

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