Exemplo n.º 1
0
        public async Task <ActionResult> DeleteRangeAsync([FromBody] List <int> sIDs)
        {
            int accountId = JWTUtility.GetIdFromRequestHeaders(Request.Headers);

            if (accountId == -1)
            {
                return(BadRequest());
            }

            foreach (var id in sIDs)
            {
                if (!await _songService.CanModifyAsync(accountId, id))
                {
                    return(Unauthorized());
                }
            }

            await _songService.DeleteRangeAsync(sIDs, accountId);

            return(Ok());
        }