Beispiel #1
0
        public async Task <ResponseFromApi <int> > CreatePost(PostDetailBlazorVM postDetailViewModel)
        {
            try
            {
                CreatedPostCommand createPostCommand =
                    _mapper.Map <CreatedPostCommand>(postDetailViewModel);

                var newId = await _client.AddPostAsync(createPostCommand);

                return(new ResponseFromApi <int>()
                {
                    Data = newId, Success = true
                });
            }
            catch (ApiException ex)
            {
                return(ex.ConvertApiExceptions());
            }
        }