示例#1
0
        public async Task <IActionResult> PostCommets([FromRoute] int id, [FromBody] CommentaryInput commentaryInput)
        {
            try
            {
                var client = await _commentaryAppService
                             .InsertAsync(id, commentaryInput)
                             .ConfigureAwait(false);

                return(Created("", client));
            }
            catch (ArgumentException arg)
            {
                return(BadRequest(arg.Message));
            }
        }
示例#2
0
        public async Task <Commentary> InsertAsync(int postageId, CommentaryInput input)
        {
            var userId = _logged.GetClientLoggedId();

            var comment = new Commentary(postageId, userId, input.Text);

            //Validar os dados obrigatorios

            var id = await _commentaryRepository
                     .InsertAsync(comment)
                     .ConfigureAwait(false);

            comment.SetId(id);

            return(comment);
        }