public IActionResult Un_RSVP(int weddingid) { WeddingAttendance this_attender = _context.weddingattendance.SingleOrDefault(a => a.UserId == HttpContext.Session.GetInt32("UserId") && a.WeddingId == weddingid); _context.weddingattendance.Remove(this_attender); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }
public IActionResult RSVP(int weddingid) { WeddingAttendance new_attendance = new WeddingAttendance { UserId = (int)HttpContext.Session.GetInt32("UserId"), WeddingId = weddingid }; _context.Add(new_attendance); _context.SaveChanges(); return(RedirectToAction("Dashboard")); }