示例#1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            var result = await pcc.AddPostAsync(ModelsMapper.GetPost(PostDTO));

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

            post.Description = PostDTO.Description;
            post.Date        = PostDTO.Date;
            var result = await pcc.AddPostAsync(post);

            if (!result)
            {
                return(RedirectToAction("Error"));
            }
            return(RedirectToPage("./Index"));
        }