Beispiel #1
0
        public async Task <IActionResult> AddFeedAsync(long id, [FromBody] FeedInputModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(new ValidateObjectResult(ModelState));
            }

            var collection = await _collectionRepository.GetCollectionAsync(id);

            if (collection == null)
            {
                return(NotFound("Invalid Collection Id"));
            }

            var feed = Feed.New(model.Title, model.Link, model.SourceType, collection);

            await _feedRepository.AddFeedAsync(feed);

            return(Ok());
        }