public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } talkData.Update(Talk); if (await talkData.Commit()) { TempData["Message"] = $"Talk Upated"; return(RedirectToPage("./detail", new { SelectedTalkId = Talk.TalkId })); } return(RedirectToPage("./NotFound")); }
public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } Talk.userId = User.Claims.First(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier").Value; talkData.Add(Talk); if (await talkData.Commit()) { Talk newTalk = talkData.GetNewest(); TempData["Message"] = $"Talk Added"; return(RedirectToPage("./Detail", new { SelectedTalkId = newTalk.TalkId })); } return(RedirectToPage("./NotFound")); }
public async Task <IActionResult> OnPost(int SelectedTalkId) { Talk = talkData.GetTalkById(SelectedTalkId); TalkComments = talkCommentData.GetAll(SelectedTalkId); if (TalkComments != null) { foreach (var comment in TalkComments) { talkCommentData.Delete(comment); } } talkData.Delete(Talk); if (await talkData.Commit()) { TempData["Message"] = $"{Talk.Name} Deleted"; return(RedirectToPage("./List", new { SelectedTypeID = Talk.TypeId })); } return(RedirectToPage("./NotFound")); }