示例#1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            post.PostId = id.Value;
            PostDTO p = await pcc.UpdatePostAsync(post);

            return(RedirectToPage("./Index"));
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Post post = new Post();

            post.PostId      = PostDTO.PostId;
            post.Domain      = PostDTO.Domain;
            post.Description = PostDTO.Description;
            post.Date        = PostDTO.Date;

            var result = await pcc.UpdatePostAsync(post);

            if (result == null)
            {
                return(RedirectToAction("Error"));
            }

            return(RedirectToPage("./Index"));
        }