예제 #1
0
 //Post Info
 public void Post([FromBody] Info info)
 {
     using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
     {
         entities.Info.Add(info);
         entities.SaveChanges();
     }
 }
예제 #2
0
 //Delete Info
 public void Delete(int id)
 {
     using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
     {
         entities.Info.Remove(entities.Info.FirstOrDefault(e => e.ID == id));
         entities.SaveChanges();
     }
 }
예제 #3
0
 //Delete Accounts
 public void Delete(string id)
 {
     using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
     {
         entities.Lec.Remove(entities.Lec.FirstOrDefault(e => e.Rid == id));
         entities.SaveChanges();
     }
 }
예제 #4
0
        //Post Accounts

        public void Post([FromBody] Lec lec)
        {
            using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
            {
                entities.Lec.Add(lec);
                entities.SaveChanges();
            }
        }
        //Post Accounts

        public void Post([FromBody] Accounts accounts)
        {
            using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
            {
                entities.Accounts.Add(accounts);
                entities.SaveChanges();
            }
        }
예제 #6
0
        //Update Info (Put)
        public void Put(int id, [FromBody] Info info)
        {
            using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
            {
                var entity = entities.Info.FirstOrDefault(e => e.ID == id);

                entity.Studentname = info.Studentname;
                entity.LecId       = info.LecId;
                entity.ATime       = info.ATime;
                entities.SaveChanges();
            }
        }
예제 #7
0
        //Update Accounts (Put)
        public void Put(string id, [FromBody] Lec lec)
        {
            using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
            {
                var entity = entities.Lec.FirstOrDefault(e => e.Rid == id);

                entity.Rid      = lec.Rid;
                entity.AdminID  = lec.AdminID;
                entity.Class    = lec.Class;
                entity.LecTime  = lec.LecTime;
                entity.DeviceID = lec.DeviceID;
                entity.Extra    = lec.Extra;
                entities.SaveChanges();
            }
        }
        //Update Accounts (Put)
        public void Put(int id, [FromBody] Accounts accounts)
        {
            using (MSSQL400028Entities1 entities = new MSSQL400028Entities1())
            {
                var entity = entities.Accounts.FirstOrDefault(e => e.ID == id);

                entity.Username = accounts.Username;
                entity.Password = accounts.Password;
                entity.Class    = accounts.Class;
                entity.isAdmin  = accounts.isAdmin;
                entity.isLogged = accounts.isLogged;
                entity.Pnumber  = accounts.Pnumber;
                entity.MobileID = accounts.MobileID;
                entities.SaveChanges();
            }
        }