Пример #1
0
        public ActionResult AddSourceToCollection(string collectionName, int sourceId)
        {
            if (!collectionService.IsCollectionNameValid(collectionName))
            {
                return(Conflict($"There is no {collectionName} collection"));
            }
            if (!sourceService.IsSourceValid(sourceId))
            {
                return(Conflict($"There is no such source"));
            }

            var collection = collectionService.AddSourceToCollection(collectionName, sourceId);

            if (collection != null)
            {
                return(CreatedAtRoute("GetCollection", new { collectionName, withIncludes = true }, collection));
            }
            return(BadRequest());
        }