/// <summary> /// Method To Allow Additional Custom Validation for the Delete method. The user can return a successful response object /// or null if the validation was successful. This method can also be used to update the request object /// </summary> /// <param name="request">Request</param> /// <returns>Response</returns> public override TResponse OnValidateRecordToDelete <TEntity, TResponse, TId>(BaseServiceDeleteRequest <TId> request, TEntity record) { var deleteRequest = request as WebsiteDataEntityDeleteRequest; var item = record as CStore.Domain.Entities.WebsiteData; return(null); }
/// <summary> /// Method to check if the record being deleted can be /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="R"></typeparam> /// <typeparam name="I"></typeparam> /// <param name="request"></param> /// <param name="record"></param> /// <returns></returns> public override R OnValidateRecordToDelete <T, R, I>(BaseServiceDeleteRequest <I> request, T record) { var deleteRequest = request as SecurityRoleMaintenanceDeleteRequest; var securityRole = record as SecurityRole; //Returning null means it is OK to be deleted. return(null); }
/// <summary> /// Method to check if the record being deleted can be /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="R"></typeparam> /// <typeparam name="I"></typeparam> /// <param name="request"></param> /// <param name="record"></param> /// <returns></returns> public override R OnValidateRecordToDelete <T, R, I>(BaseServiceDeleteRequest <I> request, T record) { var deleteRequest = request as AppMenuMaintenanceDeleteRequest; var appMenu = record as AppMenu; //Returning null means it is OK to be deleted. return(null); }
/// <summary> /// Before the record is deleted, do this functionality. /// Mainly used to delete other child objects to the one being deleted. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="R"></typeparam> /// <typeparam name="I"></typeparam> /// <param name="request"></param> /// <param name="record"></param> public override void OnRecordDelete <T, R, I>(BaseServiceDeleteRequest <I> request, T record) { var deleteRequest = request as SecurityUserMaintenanceDeleteRequest; var securityUser = record as SecurityUser; //Role Memberships var roleMemberships = _repository.GetAll <SecurityUserRoleMembership>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(roleMemberships); //SecurityUserQuestionAnswer var securityUserQuestionAnswers = _repository.GetAll <SecurityUserQuestionAnswer>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(securityUserQuestionAnswers); //Login History var loginHistory = _repository.GetAll <SecurityUserLoginHistory>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(loginHistory); //SecurityUserPasswordHistory var securityUserPasswordHistory = _repository.GetAll <SecurityUserPasswordHistory>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(securityUserPasswordHistory); //SecurityPasswordResetRequest var securityPasswordResetRequests = _repository.GetAll <SecurityPasswordResetRequest>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(securityPasswordResetRequests); //SecuritySingleSignOnToken var securitySingleSignOnTokens = _repository.GetAll <SecuritySingleSignOnToken>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(securitySingleSignOnTokens); //SecurityUserActivation var securityUserActivations = _repository.GetAll <SecurityUserActivation>() .Where(p => p.SecurityUserId == securityUser.SecurityUserId).ToList(); _repository.DeleteAll(securityUserActivations); _repository.Commit(); }
/// <summary> /// Before the record is deleted, do this functionality. /// Mainly used to delete other child objects to the one being deleted. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="R"></typeparam> /// <typeparam name="I"></typeparam> /// <param name="request"></param> /// <param name="record"></param> public override void OnRecordDelete <T, R, I>(BaseServiceDeleteRequest <I> request, T record) { var deleteRequest = request as AppMenuMaintenanceDeleteRequest; var appMenu = record as AppMenu; //App Menu Items var appMenuItems = _repository.GetAll <AppMenuItem>() .Where(p => p.AppMenuId == appMenu.AppMenuId).ToList(); _repository.DeleteAll(appMenuItems); }
/// <summary> /// Before the record is deleted, do this functionality. /// Mainly used to delete other child objects to the one being deleted. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="R"></typeparam> /// <typeparam name="I"></typeparam> /// <param name="request"></param> /// <param name="record"></param> public override void OnRecordDelete <T, R, I>(BaseServiceDeleteRequest <I> request, T record) { var deleteRequest = request as SecurityRoleMaintenanceDeleteRequest; var securityRole = record as SecurityRole; //Security Access var securityAccesses = _repository.GetAll <SecurityAccess>() .Where(p => p.SecurityRoleId == securityRole.SecurityRoleId).ToList(); _repository.DeleteAll(securityAccesses); //Security User Role Membership var securityUserRoleMemberships = _repository.GetAll <SecurityUserRoleMembership>() .Where(p => p.SecurityRoleId == securityRole.SecurityRoleId).ToList(); _repository.DeleteAll(securityUserRoleMemberships); }
/// <summary> /// Before the record is deleted, do this functionality. /// Mainly used to delete other child objects to the one being deleted. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="R"></typeparam> /// <typeparam name="I"></typeparam> /// <param name="request"></param> /// <param name="record"></param> public override void OnRecordDelete <T, R, I>(BaseServiceDeleteRequest <I> request, T record) { var deleteRequest = request as SecurityActionMaintenanceDeleteRequest; var securityAction = record as SecurityAction; //Security Access var securityAccesses = _repository.GetAll <SecurityAccess>() .Where(p => p.SecurityActionId == securityAction.SecurityActionId).ToList(); _repository.DeleteAll(securityAccesses); //Security Securable Actions var securitySecurableActions = _repository.GetAll <SecuritySecurableAction>() .Where(p => p.SecurityActionId == securityAction.SecurityActionId).ToList(); _repository.DeleteAll(securitySecurableActions); _repository.Commit(); }
/// <summary> /// Method To Allow Additional Custom Delete Logic. THis method occurs before the record is deleted /// </summary> /// <param name="request">Request</param> /// <returns></returns> public override void OnRecordDelete <TEntity, TResponse, TId>(BaseServiceDeleteRequest <TId> request, TEntity record) { var deleteRequest = request as WebsiteDataEntityDeleteRequest; var item = record as CStore.Domain.Entities.WebsiteData; }