Exemplo n.º 1
0
        public async Task <IActionResult> ProductDelete(GridSelection selection)
        {
            var ids        = selection.GetEntityIds();
            var numDeleted = 0;

            if (ids.Any())
            {
                var products = await _db.Products.GetManyAsync(ids, true);

                // TODO: (core) Actually delete!
                numDeleted = products.Count;
            }

            return(Json(new { Success = true, Count = numDeleted }));
        }
        public async Task <IActionResult> QueuedEmailDelete(GridSelection selection)
        {
            var ids        = selection.GetEntityIds().ToList();
            var numDeleted = 0;

            if (ids.Any())
            {
                numDeleted = await _db.QueuedEmails
                             .Where(x => ids.Contains(x.Id))
                             .BatchDeleteAsync();
            }

            return(Json(new
            {
                Success = true,
                Count = numDeleted
            }));
        }
        public async Task <IActionResult> GenericAttributeDelete(GridSelection selection, string entityName)
        {
            var ids        = selection.GetEntityIds();
            var numDeleted = 0;

            if (ids.Any())
            {
                var(readPermission, updatePermission) = GetGenericAttributesInfos(entityName);

                if (updatePermission.HasValue() && !await Services.Permissions.AuthorizeAsync(updatePermission))
                {
                    NotifyError(await Services.Permissions.GetUnauthorizedMessageAsync(updatePermission));
                    return(Json(new { Success = false, Count = numDeleted }));
                }

                numDeleted = await _db.GenericAttributes
                             .Where(x => ids.Contains(x.Id))
                             .BatchDeleteAsync();
            }

            return(Json(new { Success = true, Count = numDeleted }));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> DeleteExecutionInfos(GridSelection selection)
        {
            var numDeleted = await _taskStore.DeleteExecutionInfosByIdsAsync(selection.GetEntityIds());

            return(Json(new { Success = true, Count = numDeleted }));
        }