示例#1
0
        public ActionResult ViewDB(string DbContext)
        {
            try
            {
                if (!Authen.Certification(Session["UserClass"].ToString(), Authen.UserClass.Admin))
                {
                    return(RedirectToAction("PermitionEr", "Error"));
                }
                HomeworkDBContext       homeworkDB       = new HomeworkDBContext();
                CommentDBContext        commentDB        = new CommentDBContext();
                UserDBContext           userDB           = new UserDBContext();
                CategoryDBContext       categoryDB       = new CategoryDBContext();
                UserCategoriesDBcontext userCategoriesDB = new UserCategoriesDBcontext();
                NoteCatDBContext        noteCatDB        = new NoteCatDBContext();
                ClassNotiDBcontext      classNotiDB      = new ClassNotiDBcontext();



                return(View());
            }
            catch
            {
                return(RedirectToAction("LoginEr", "Error"));
            }
        }
示例#2
0
 public HomeworkController(HomeworkDBContext context, UserDBContext userDB, NoteCatDBContext noteCatDB,
                           SelectedCategoriesDBcontext userCatDB, NoteClassDBContext noteClassDB, CommentDBContext commentDB)
 {
     _context         = context;
     this.userDB      = userDB;
     this.userCatDB   = userCatDB;
     this.noteCatDB   = noteCatDB;
     this.noteClassDB = noteClassDB;
     this.commentDB   = commentDB;
 }
示例#3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Homework         homework = db.Homework.Find(id);
            CommentDBContext cdb      = new CommentDBContext();
            var comments = from a in cdb.Comment.ToList()
                           where a.ParentNo == id
                           select a;

            foreach (var item in comments)
            {
                cdb.Comment.Remove(item);
            }
            db.Homework.Remove(homework);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
 public CommentsRepository(CommentDBContext context)
 {
     _context = context;
 }
示例#5
0
 public CommentController(CommentDBContext context, ICommentsRepository _repo)
 {
     CommentRepo = _repo;
 }