Esempio n. 1
0
        public ServiceResponse Create(CreatPostInDto input)
        {
            var user = GetAuthenticatedUser();

            if (user.IsAuthenticated)
            {
                var post = _mapper.Map <Post>(input);
                post.SetAuthor(user.UserId, user.UserName);
                _postRepository.Add(post);
                _postRepository.Complete();
                s_diagnosticListener.WriteAddOrUpdatePostAfter(post);
                return(ServiceResponse.OK());
            }
            return(ServiceResponse.Unauthorized());
        }