Пример #1
0
 protected virtual async Task OnAfterDelete(GridDeleteComponent <T> component)
 {
     if (AfterDelete != null)
     {
         await AfterDelete.Invoke(component, _item);
     }
 }
Пример #2
0
 protected virtual async Task <bool> OnBeforeDelete(GridDeleteComponent <T> component)
 {
     if (BeforeDelete != null)
     {
         return(await BeforeDelete.Invoke(component, _item));
     }
     return(true);
 }
Пример #3
0
        public async Task DeleteItem(GridDeleteComponent <T> component)
        {
            try
            {
                bool isValid = await OnBeforeDelete(component);

                if (isValid)
                {
                    var keys = Grid.GetPrimaryKeyValues(_item);
                    await((CGrid <T>)Grid).CrudDataService.Delete(keys);
                    ((CGrid <T>)Grid).Mode = GridMode.Grid;
                    CrudRender             = null;
                    _fromCrud = true;
                    await UpdateGrid();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw;
            }
        }