public IActionResult DeleteWedding(int wedId)
        {
            Wedding One = dbContext.weddings.FirstOrDefault(p => p.WeddingId == wedId);

            dbContext.Remove(One);
            dbContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Exemplo n.º 2
0
        // ***************************** Delete wedding**********************************
        public IActionResult Delete(int id)
        {
            Wedd weddLog = _context.weddings.SingleOrDefault(wed => wed.id == id);

            _context.Remove(weddLog);
            _context.SaveChanges();
            return(RedirectToAction("AllWeddings"));
        }
Exemplo n.º 3
0
        public IActionResult unRSVP(int id)
        {
            int   CurrentUser = (int)HttpContext.Session.GetInt32("CurrUserId");
            Guest UnRsvp      = _context.Guests.Where(user => user.UserId == CurrentUser).Where(wedding => wedding.WeddingId == id).SingleOrDefault();

            _context.Remove(UnRsvp);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IActionResult DeleteAttendance(int WeddingId)
        {
            int?  UserID = HttpContext.Session.GetInt32("UserID");
            Guest guest  = dbContext.Guest
                           .FirstOrDefault(g => g.UserId == UserID && g.WeddingId == WeddingId);

            dbContext.Remove(guest);
            dbContext.SaveChanges();

            return(RedirectToAction("dashboard"));
        }
Exemplo n.º 5
0
 public IActionResult DeleteWedding(int wedid)
 {
     int? id = HttpContext.Session.GetInt32("ActiveId");
     int ActiveId = (int)id;
     Wedding wedding = _context.Weddings.SingleOrDefault(w => w.WedId == wedid);
     if (ActiveId == wedding.User_Id)
     {
         _context.Remove(wedding);
         _context.SaveChanges();
         return RedirectToAction("Dashboard");
     }
     else
     {
         ModelState.AddModelError(string.Empty, "You cannot delete that!");
         return RedirectToAction("Dashboard");
     }
 }
Exemplo n.º 6
0
        public IActionResult Delete(int id)
        {
            List <Guests> RemoveFirst = _context.Guests.Where(w => w.WeddingId == id).Include(p => p.Wedding).ToList();

            if (RemoveFirst != null)
            {
                foreach (Guests item in RemoveFirst)
                {
                    _context.Remove(item);
                }
            }
            Wedding RemoveSecond = _context.Weddings.SingleOrDefault(u => u.WeddingId == id);

            _context.Weddings.Remove(RemoveSecond);
            _context.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Exemplo n.º 7
0
        public IActionResult Delete(int id)
        {
            Wedding RetrievedWedding = _context.Weddings.SingleOrDefault(w => w.WeddingId == id);

            _context.Remove(RetrievedWedding);
            _context.SaveChanges();
            return(RedirectToAction("Success"));
        }
Exemplo n.º 8
0
        public IActionResult UnRSVP(int WeddingId)
        {
            Guest removeGuest = _weddingPlannerContext.Guest
                                .Where(g => g.WeddingId == WeddingId && g.UserId == (int)HttpContext.Session.GetInt32("ActiveUserId"))
                                .SingleOrDefault();

            _weddingPlannerContext.Remove(removeGuest);
            _weddingPlannerContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
        public IActionResult Delete(int weddingId)
        {
            Wedding thiswedding = db.Weddings.FirstOrDefault(w => w.WeddingId == weddingId);

            db.Remove(thiswedding);
            db.SaveChanges();


            return(RedirectToAction("WeddingPlanner"));
        }
Exemplo n.º 10
0
        public IActionResult UnRSVPToWedding(int weddingId)
        {
            Wedding     retrievedWedding = dbContext.Weddings.FirstOrDefault(w => w.WeddingId == weddingId);
            User        loggedUser       = dbContext.Users.FirstOrDefault(u => u.UserId == HttpContext.Session.GetInt32("logged"));
            List <RSVP> retrievedRSVPs   = dbContext.RSVPs
                                           .Where(r => r.WeddingId == retrievedWedding.WeddingId).ToList();
            RSVP retrievedRSVP = retrievedRSVPs.FirstOrDefault(r => r.UserId == loggedUser.UserId);

            dbContext.Remove(retrievedRSVP);
            dbContext.SaveChanges();
            PopulateBag();
            return(RedirectToAction("Dashboard"));
        }