Exemplo n.º 1
0
        public IActionResult UploadImage(int id, IFormFile image)
        {
            var comment = CommentManager.Get(id);

            if (comment == null)
            {
                return(NotFound());
            }
            if (comment.AccountId != User.Claims.FirstOrDefault(c => c.Type == "UserId").Value)
            {
                return(Unauthorized());
            }

            CommentManager.UploadImage(image, comment);
            return(NoContent());
        }