コード例 #1
0
        public IActionResult RSVP(int wedID)
        {
            WedUser weduser = new WedUser();

            weduser.UserId    = (int)HttpContext.Session.GetInt32("UserId");
            weduser.WeddingId = wedID;
            dbContext.WedUsers.Add(weduser);
            dbContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
コード例 #2
0
        public IActionResult UNSRVP(int wedID)
        {
            WedUser toDelete = dbContext.WedUsers.FirstOrDefault(u => u.WeddingId == wedID);

            if (toDelete == null)
            {
                return(RedirectToAction("Dashboard"));
            }

            dbContext.WedUsers.Remove(toDelete);
            dbContext.SaveChanges();

            return(RedirectToAction("Dashboard"));
        }