Esempio n. 1
0
 public IActionResult OnPost()
 {
     if (!ModelState.IsValid)
     {
         return(Page());
     }
     if (Post.Id > 0)
     {
         postData.Update(Post);
     }
     else
     {
         postData.Add(Post);
     }
     postData.Commit();
     TempData["Message"] = "Post Saved!";
     return(RedirectToPage("/Detail", new { postId = Post.Id }));
 }