Ejemplo n.º 1
0
        public IActionResult CreateCommentaryForTopic(Guid topicId, [FromBody] CommentaryForCreation commentaryForCreation)
        {
            if (!noterRepository.TopicExists(topicId))
            {
                return(NotFound());
            }

            if (commentaryForCreation == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var commentaryEntity = Mapper.Map <Commentary>(commentaryForCreation);

            noterRepository.CreateCommentaryForTopic(commentaryEntity);

            noterRepository.Save();

            return(Ok()); // TO DO - to be implemented created at route
        }
Ejemplo n.º 2
0
        public IActionResult CreateTopic([FromBody] TopicForCreationDto topicForCreation)
        {
            if (topicForCreation == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var topicEntity = Mapper.Map <Topic>(topicForCreation);

            noterRepository.CreateTopic(topicEntity);

            noterRepository.Save();

            return(Ok()); // TO DO - to be implemented created at route
        }