Beispiel #1
0
        public ActionResult DeleteSourceFromCollection(string collectionName, int sourceId)
        {
            if (!collectionService.IsCollectionNameValid(collectionName))
            {
                return(Conflict($"There is no {collectionName}"));
            }
            if (!collectionService.IsCollectionContainSource(collectionName, sourceId))
            {
                return(Conflict($"There is no such in {collectionName}"));
            }

            var isDeleted = collectionService.DeleteSourceFromCollection(collectionName, sourceId);

            if (isDeleted)
            {
                logger.LogInformation($"Source {sourceId} deleted from {collectionName}");
                return(NoContent());
            }
            return(NotFound());
        }