コード例 #1
0
        public IActionResult DeleteConfirmed(int id)
        {   /*Delete code from parent table */
            var c1 = (from a in _context.Allvideo where a.VideoId == id select a);

            _context.RemoveRange(c1);
            _context.SaveChanges();


            /*Delete code from chilled table */
            var c = _context.Videonews.Find(id);

            _context.Videonews.Remove(c);
            _context.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            var c1 = (from a in _context.Allvideo where a.VideoId == id select a);

            // c1=_context.Allvideo.Find(m=>m.)
            _context.RemoveRange(c1);
            _context.SaveChanges();

            var c = _context.Videonews.Find(id);

            _context.Videonews.Remove(c);
            _context.SaveChanges();

            //var videonews = _context.Videonews.Find(id);
            //_context.Videonews.Remove(videonews);
            //_context.SaveChangesAsync();
            return(RedirectToAction(nameof(Index)));
        }