public IActionResult LikePost(JoinAct formJoinAct) { if (ModelState.IsValid) { formJoinAct.User = _context.Users.SingleOrDefault(u => u.userId == formJoinAct.userId); formJoinAct.Activities = _context.Activities.SingleOrDefault(u => u.activityId == formJoinAct.activityId); _context.JoinAct.Add(formJoinAct); _context.SaveChanges(); return(RedirectToAction("SuccessPage")); } else { Console.WriteLine("Something went wrong with liking"); return(RedirectToAction("SuccessPage")); } }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 1 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" List <Activitys> Activites = Model.AllActivities; JoinAct CurUser = ViewBag.CurUser; #line default #line hidden BeginContext(119, 326, true); WriteLiteral(@"<h1>Dojo Activity Center</h1> <a href=""/success"">Home</a><a href=""/logout"">Logout</a> <table> <thead> <th>Activity</th> <th>Date and Time</th> <th>Duration</th> <th>Event Coordinator</th> <th>Number of Participants</th> <th>Actions</th> </thead> <tbody> "); EndContext(); #line 18 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" foreach (Activitys Cur in Activites) { #line default #line hidden BeginContext(492, 34, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(527, 16, false); #line 20 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" Write(Cur.activityName); #line default #line hidden EndContext(); BeginContext(543, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(567, 28, false); #line 21 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" Write(Cur.setdate.ToString("M/dd")); #line default #line hidden EndContext(); BeginContext(595, 6, true); WriteLiteral(" @ "); EndContext(); BeginContext(602, 32, false); #line 21 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" Write(Cur.settime.ToString("hh:mm tt")); #line default #line hidden EndContext(); BeginContext(634, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(658, 12, false); #line 22 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" Write(Cur.duration); #line default #line hidden EndContext(); BeginContext(670, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(694, 18, false); #line 23 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" Write(Cur.User.FirstName); #line default #line hidden EndContext(); BeginContext(712, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(736, 16, false); #line 24 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" Write(Cur.Roster.Count); #line default #line hidden EndContext(); BeginContext(752, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); #line 25 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" if (@ViewBag.AllLikedPost.Contains(@Cur.activityId) == false) { #line default #line hidden BeginContext(840, 16, true); WriteLiteral(" "); EndContext(); BeginContext(856, 338, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "e30c236c1eaf4c0aae70e6ebca85ea50", async() => { BeginContext(891, 30, true); WriteLiteral("\r\n "); EndContext(); BeginContext(921, 71, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "e9df5c31d2044050beee7caced5c3672", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); #line 27 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.FormJoinAct.userId); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); #line 27 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" WriteLiteral(Model.IDXID); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Value = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("value", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(992, 80, true); WriteLiteral("\r\n <input type=\"hidden\" name=\"FormJoinAct.activityId\""); EndContext(); BeginWriteAttribute("value", " value=\"", 1072, "\"", 1095, 1); #line 28 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" WriteAttributeValue("", 1080, Cur.activityId, 1080, 15, false); #line default #line hidden EndWriteAttribute(); BeginContext(1096, 91, true); WriteLiteral(">\r\n <input type=\"submit\" value=\"Join\">\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1194, 2, true); WriteLiteral("\r\n"); EndContext(); #line 31 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" } #line default #line hidden BeginContext(1219, 34, true); WriteLiteral(" </td>\r\n </tr>\r\n"); EndContext(); #line 34 "C:\Users\jerem\Desktop\ExamCRetake\Views\Home\dashboard.cshtml" } #line default #line hidden BeginContext(1264, 22, true); WriteLiteral(" </tbody>\r\n</table>"); EndContext(); }