protected IActionResult DeleteResource(Guid id)
        {
            var resource = ResourceDataService.Get(id);

            if (resource == null)
            {
                return(NotFound(ResourceNotFound(id.ToString())));
            }
            ResourceDataService.Delete(resource);
            ResourceDataService.SaveChanges();
            return(NoContent());
        }
Exemple #2
0
        public new IActionResult DeleteResource(Guid id)
        {
            var resource = ResourceDataService.Get(id);

            if (resource == null || resource.SubscriberId != User.Claims.First(claim => claim.Type == JwtClaimTypes.Subject).Value)
            {
                return(NotFound(ResourceNotFound(id.ToString())));
            }

            CancelExecution(id);
            ResourceDataService.Delete(resource);
            ResourceDataService.SaveChanges();
            return(NoContent());
        }