示例#1
0
        public async Task <IActionResult> Delete(string id)
        {
            User users = new User();

            users = _context.Users.Find(id);
            _context.Remove(users);
            await _context.SaveChangesAsync();

            return(View("Show", "ManageContent"));
        }
        public async Task <IActionResult> Delete(int id)
        {
            Updates up = new Updates();

            up = _context.Updates.Find(id);
            if (up.UpdateType.Equals("轮播图"))
            {
                ScrollPics scroll = new ScrollPics();
                scroll = _context.ScrollPic.FirstOrDefault(p => p.ImgUrl.Equals(up.UpdateContent));
                _context.Remove(scroll);
            }
            else
            {
                Articles article = new Articles();
                article = _context.Article.FirstOrDefault(p => p.Areas.Equals(up.UpdateType) && p.ArticleName.Equals(up.UpdateContent));
                _context.Remove(article);
            }
            _context.Remove(up);
            await _context.SaveChangesAsync();

            return(View("Update"));
        }