Пример #1
0
 void OnBeforeDeleteWrapper(string key, bool isManagerCall)
 {
     if (isManagerCall)
     {
         return;
     }
     ThreadHelper.RunOnDifferentThread(() =>
     {
         OnBeforeDelete?.Invoke(key);
     }, true);
 }
Пример #2
0
        public virtual async Task Delete(IValidator validator)
        {
            if (FormState == FormState.Delete)
            {
                if (OnBeforeDelete == null)
                {
                    Response = await HttpService.Delete <T>(Identifier, validator);

                    InternalResponse(FormState.Deleted);
                }
                else
                {
                    OnBeforeDelete.Invoke(async() => {
                        Response = await HttpService.Delete <T>(Identifier, validator);
                        InternalResponse(FormState.Deleted);
                    });
                }
                OnAfterDelete?.Invoke(Response.Response.Data);
            }
        }
 public virtual IActionResult DeleteEntity(string entityName, string entityId)
 {
     try
     {
         string requestName = $"{nameof(DeleteEntity)} : Entity Name = {entityName} : Entity ID = {entityId}";
         LogWebRequest(requestName, null);
         ValidateRequestMethod(HttpVerb.DELETE);
         string userName   = GetCurrentUserName();
         Type   entityType = GetEntityType(entityName);
         OnBeforeDelete?.Invoke(this, new NKitRestApiDeleteEntityEventArgs(entityName, userName, DbContext, entityType, entityId));
         DbContext.DeleteBySurrogateKey(entityId, null, entityType);
         OnAfterDelete?.Invoke(this, new NKitRestApiDeleteEntityEventArgs(entityName, userName, DbContext, entityType, entityId));
         string responseMessage = string.Format("{0} deleted successfully.", entityName);
         LogWebResponse(requestName, responseMessage);
         return(Ok(responseMessage));
     }
     finally
     {
         DisposeEntityContext();
     }
 }
Пример #4
0
 protected void RaiseOnBeforeDelete(T t) => OnBeforeDelete?.Invoke(t);
 private void deleteThisObject()
 {
     OnBeforeDelete.Invoke(this);
     Destroy(gameObject);
 }