示例#1
0
        public async Task <IActionResult> OnGetAsync(Guid id, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotEmpty(id, nameof(id));
            var p = await postService.GetById(id, cancellationToken);

            return(p.Match(post =>
            {
                this.Post = post;
                return Page().ToIAR();
            }, () => this.NotFound().ToIAR()));
        }
示例#2
0
        public async Task <IActionResult> OnGet(Guid id, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotEmpty(id, nameof(id));
            var f = await this.fileService.GetPostFile(id, cancellationToken);

            return(await f.Match(async some =>
            {
                var p = await this.postService.GetById(some.Id, cancellationToken);
                return p.Match(post =>
                {
                    this.Post = post;
                    return Page();
                }, this.NotFound().ToIAR);
            }, () => this.NotFound().ToIART()));
        }
示例#3
0
        public async Task <IActionResult> OnGet(Guid id, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotEmpty(id, nameof(id));
            var hash = await this.userService.GetHashForPost(id, cancellationToken);

            return(await hash.Match(async some =>
            {
                var p = await this.postService.GetById(id, cancellationToken);
                return p.Match(post =>
                {
                    this.Post = post;
                    this.Expiry = DateTime.UtcNow.AddDays(7);
                    return Page().ToIAR();
                }, this.NotFound().ToIAR);
            }, () => this.NotFound().ToIART()));
        }