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")); }
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")); }