public async Task <IActionResult> OnPostAsync(int?TopicId) { if (!ModelState.IsValid) { return(Page()); } _context.Topic.Add(Topic); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?TopicId) { if (!ModelState.IsValid) { return(Page()); } Reply.MessageDate = DateTime.Now; _context.Reply.Add(Reply); await _context.SaveChangesAsync(); return(await OnGetAsync(TopicId)); }