Esempio n. 1
0
        public async Task <IActionResult> Delete(int[] ids)
        {
            var entities = await _functionService.FindAsync(ids);

            if (entities.Any())
            {
                foreach (var item in entities)
                {
                    var hasSubFunctions = await _functionService.HasSubFunctions(item.Id);

                    if (hasSubFunctions)
                    {
                        ModelState.TryAddModelError(
                            string.Empty,
                            $"Cannot delete function {item.Name} because it has sub functions.");
                    }
                    else
                    {
                        await _functionService.DeleteAsync(item);
                    }
                }
            }

            return(Ok());
        }
Esempio n. 2
0
        public async Task <IActionResult> Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(new BadRequestResult());
            }
            else
            {
                await _functionService.DeleteAsync(id);

                _functionService.Save();
                return(new OkObjectResult(id));
            }
        }
Esempio n. 3
0
        public async override Task <IActionResult> DeleteFunctionAsync([FromRoute, Required] Guid functionId)
        {
            await functionService.DeleteAsync(functionId);

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> Delete(params long[] id)
        {
            await _service.DeleteAsync(id);

            return(JsonData(true));
        }
Esempio n. 5
0
 public async Task <AjaxResult> DeleteAsync(Guid id)
 {
     return((await _functionService.DeleteAsync(id)).ToAjaxResult());
 }