Пример #1
0
        public IActionResult Delete(int secret_id)
        {
            Secret CurrentSecret = _context.Secrets.SingleOrDefault(sec => sec.Id == secret_id);

            _context.Remove(CurrentSecret);
            _context.SaveChanges();

            return(RedirectToAction("Secrets"));
        }
Пример #2
0
        public IActionResult Delete(int num)
        {
            //    if(HttpContext.Session.GetInt32("id") == null) {
            //     return RedirectToAction("Logout");};

            Post del = _context.posts.SingleOrDefault(u => u.Postid == num);

            _context.Remove(del);
            _context.SaveChanges();
            return(RedirectToAction("Wall"));
        }
Пример #3
0
        public IActionResult UnRSVP(int id)
        {
            if (HttpContext.Session.GetInt32("CurrentUserId") == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            int        CurrentUser = (int)HttpContext.Session.GetInt32("CurrentUserId");
            Invitation UnRSVP      = _context.Invitations
                                     .Where(user => user.UserId == CurrentUser)
                                     .Where(wedding => wedding.WeddingId == id)
                                     .SingleOrDefault();

            _context.Remove(UnRSVP);
            _context.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Пример #4
0
        public IActionResult Delete(int id)
        {
            if (HttpContext.Session.GetInt32("CurrentUserId") == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            Activity DeleteWedding = _context.Activities
                                     .Where(wedding => wedding.ActivitiesId == id)
                                     .Include(a => a.Invitations)
                                     .SingleOrDefault();

            //Remove

            _context.Remove(DeleteWedding);
            _context.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Пример #5
0
        public IActionResult Delete(int id)
        {
            List <FunMaker> RemoveFirst = _context.FunMaker.Where(w => w.ActivityId == id).Include(p => p.Activity).ToList();

            if (RemoveFirst != null)
            {
                foreach (FunMaker item in RemoveFirst)
                {
                    _context.Remove(item);
                }
            }
            Activity RemoveSecond = _context.Activity.SingleOrDefault(u => u.ActivityId == id);

            _context.Activity.Remove(RemoveSecond);
            _context.SaveChanges();
            return(RedirectToAction("OurActivites"));
        }
        public IActionResult DELETE(int wedding_id)
        {
            Wedding CurrentWedding = _context.Weddings.SingleOrDefault(wed => wed.Id == wedding_id);

            _context.Remove(CurrentWedding);
            _context.SaveChanges();

            return(RedirectToAction("Dashboard"));
        }
Пример #7
0
        public IActionResult Delete(int idea_id)
        {
            int?user_id = HttpContext.Session.GetInt32("id");

            if (user_id == null)
            {
                return(Redirect("/"));
            }

            Idea CurrentIdea = _context.Ideas.SingleOrDefault(idea => idea.Id == idea_id);

            _context.Remove(CurrentIdea);
            _context.SaveChanges();

            return(RedirectToAction("Ideas"));
        }
Пример #8
0
        public IActionResult Delete(int num)
        {
            if (HttpContext.Session.GetInt32("id") == null)
            {
                return(RedirectToAction("Logout", "User"));
            }
            ;

            Wedding wed = _context.weddings.SingleOrDefault(u => u.Id == num);

            _context.Remove(wed);
            _context.SaveChanges();


            return(RedirectToAction("Dash"));
        }
Пример #9
0
        public IActionResult delete(int id)
        {
            Idea CurrentPost = _context.ideas.SingleOrDefault(p => p.IdeaId == id); //this if check not gonna allows other to delete

            if (CurrentPost.UserId == (int)HttpContext.Session.GetInt32("userID"))  //the post which I have created by fowwing the delete route (security perpose)
            {
                Idea deleteidea = _context.ideas.SingleOrDefault(i => i.IdeaId == id);

                _context.Remove(deleteidea);
                _context.SaveChanges();
                return(RedirectToAction("brightideas"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Пример #10
0
        public IActionResult Delete(int num, string word)
        {
            if (HttpContext.Session.GetInt32("id") == null)
            {
                return(RedirectToAction("Logout"));
            }
            ;

            Idea del = _context.ideas.SingleOrDefault(u => u.Ideaid == num);

            _context.Remove(del);
            _context.SaveChanges();
            if (word == "ideas")
            {
                return(RedirectToAction("Ideas"));
            }
            return(RedirectToAction("Popular"));
        }