public object RemoveContent([FromBody] RemoveContentInput removeContentInput)
        {
            if (!ModelState.IsValid)
            {
                return(new
                {
                    success = false,
                    errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => new { description = e.ErrorMessage }),
                });
            }

            var contentType = ContentTypeProvider.Get(removeContentInput.ContentTypeId);
            var content     = ContainerSpecificContentGetter.Get <IContent>(removeContentInput.Id, null, contentType.Container);

            if (content.ContentTypeId != contentType.Id)
            {
                throw new Exception($"Content is not of type {contentType.Id}");
            }

            ContainerSpecificContentDeleter.Delete(content.Id, contentType.Container);

            return(new
            {
                success = true,
            });
        }
Ejemplo n.º 2
0
        public async Task <IdentityResult> DeleteAsync(User user, CancellationToken cancellationToken)
        {
            await ContainerSpecificContentDeleter.DeleteAsync(user.Id, Container);

            return(IdentityResult.Success);
        }