Esempio n. 1
0
        public async Task <IActionResult> AddPost(AddPostDto addPostDto)
        {
            List <PostTag> postTags = await _tagRepo.GetTagsAndUpdateAmmountAdding(addPostDto.Description);

            Post post = new Post
            {
                UserId      = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value),
                Description = addPostDto.Description,
                CreateAt    = DateTime.Now,
                Photos      = addPostDto.Photos,
                PostTags    = postTags
            };

            _repo.Add(post);

            await _repo.SaveAll();

            return(StatusCode(201));
        }