コード例 #1
0
        public async Task <ActionResult <bool> > DeleteMany([FromBody] string[] idList)
        {
            if (idList == null)
            {
                return(BadRequest("Array is equal to null"));
            }

            if (idList.Length == 0)
            {
                return(BadRequest("Array is empty"));
            }

            if (idList.Any(x => string.IsNullOrEmpty(x) || string.IsNullOrWhiteSpace(x)))
            {
                return(BadRequest("Some id values are empty strings"));
            }

            var result = await _groupManager.DeleteManyAsync(idList);

            if (result)
            {
                return(Ok("All groups have been deleted successfully"));
            }

            return(NotFound("Some groups haven't been found"));
        }