Exemplo n.º 1
0
        public void Delete(Guid CaThiID, Guid MonThiID, Guid PhongThiID)
        {
            CtMtsController ctmt    = new CtMtsController();
            Guid?           ctmtID  = ctmt.GetCtMtID(CaThiID, MonThiID);
            DiaDiem         diadiem = db.DiaDiem.Where(u => u.CaMtId == ctmtID && u.PhongThiId == PhongThiID).FirstOrDefault();

            db.DiaDiem.Remove(diadiem);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public IQueryable <PhongThi> GetByCtMt(Guid CaThiID, Guid MonThiID)
        {
            CtMtsController       ctmt   = new CtMtsController();
            Guid?                 ctmtID = ctmt.GetCtMtID(CaThiID, MonThiID);
            IQueryable <PhongThi> temp   = db.PhongThi.FromSqlRaw("SELECT PhongThi.* FROM PhongThi " +
                                                                  "INNER JOIN DiaDiem ON DiaDiem.PhongThiID = PhongThi.PhongThiID " +
                                                                  $"WHERE DiaDiem.CaMtID  = '{ctmtID}'").OrderBy(u => u.PhongThiName);

            return(temp);
        }
Exemplo n.º 3
0
        public IQueryable <User> GetByDiaDiem(Guid CaThiID, Guid MonThiID, Guid PhongThiID)
        {
            CtMtsController    ctmt      = new CtMtsController();
            Guid?              camtid    = ctmt.GetCtMtID(CaThiID, MonThiID);
            DiaDiemsController diadiem   = new DiaDiemsController();
            Guid?              diadiemid = diadiem.GetDiaDiemID(PhongThiID, camtid);
            string             query     = "SELECT [User].* FROM [User] " +
                                           "INNER JOIN SV_DiaDiem ON SV_DiaDiem.UserID = [User].UserID " +
                                           $"WHERE SV_DiaDiem.DiaDiemID = '{diadiemid}'";
            IQueryable <User> user = db.User.FromSqlRaw(query);

            return(user);
        }
Exemplo n.º 4
0
        public void Add(Guid CaThiID, Guid MonThiID, Guid PhongThiID)
        {
            CtMtsController ctmt    = new CtMtsController();
            Guid?           ctmtID  = ctmt.GetCtMtID(CaThiID, MonThiID);
            bool            isValid = db.DiaDiem.Where(u => u.CaMtId == ctmtID && u.PhongThiId == PhongThiID).Count() == 0;

            if (isValid)
            {
                DiaDiem diadiem = new DiaDiem();
                diadiem.DiaDiemId  = Guid.NewGuid();
                diadiem.CaMtId     = ctmtID;
                diadiem.PhongThiId = PhongThiID;
                db.DiaDiem.Add(diadiem);
                db.SaveChanges();
            }
        }