public IActionResult GetTags() { logger.LogInformation("Start GetTags"); var tags = feedsRepository.GetAllTags(); logger.LogInformation("GetTags is successful complete"); return(Ok(tags)); }
public async Task <IActionResult> AddFeedSource(string tagName, [FromBody] FeedSourceDto feedSourceDto) { if (!ModelState.IsValid) { return(new UnprocessableEntityObjectResult(ModelState)); } var tag = feedsRepository.GetAllTags().FirstOrDefault(x => x.Name.ToLower() == tagName.ToLower()); if (tag == null) { BadRequest(); } var feedSource = mapper.Map <FeedSource>(feedSourceDto); logger.LogInformation(" feedSource.Type ==> " + feedSource.Type.ToString()); feedSource.TagId = tag.Id; logger.LogInformation(" tag.Id ==> " + tag.Id); await feedsRepository.AddFeedSource(feedSource); return(StatusCode(201)); }