Beispiel #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            var client = new PostCommentServiceClient();
            await client.AddPostAsync(Post);

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            var id = (string)Request.RouteValues["id"];

            if (!Guid.TryParse(id, out var postId))
            {
                return(RedirectToPage("./Index"));
            }

            var client = new PostCommentServiceClient();
            await client.AddPostCommentAsync(postId, new CommentDto { Text = Comment });

            return(RedirectToPage());
        }
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var client = new PostCommentServiceClient();

            Post = (await client.GetPostsAsync()).SingleOrDefault(p => p.Id == id);

            if (Post == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var client = new PostCommentServiceClient();

            Post = (await client.GetPostsAsync()).SingleOrDefault(p => p.Id == id);

            if (Post != null)
            {
                await client.DeletePostAsync(id.Value);
            }

            return(RedirectToPage("./Index"));
        }
        public async Task OnGetAsync()
        {
            var client = new PostCommentServiceClient();

            Posts = await client.GetPostsAsync();
        }
Beispiel #6
0
 public MainForm()
 {
     client = new PostCommentServiceClient();
     InitializeComponent();
 }