//Post Info public void Post([FromBody] Info info) { using (MSSQL400028Entities1 entities = new MSSQL400028Entities1()) { entities.Info.Add(info); entities.SaveChanges(); } }
//Delete Info public void Delete(int id) { using (MSSQL400028Entities1 entities = new MSSQL400028Entities1()) { entities.Info.Remove(entities.Info.FirstOrDefault(e => e.ID == id)); entities.SaveChanges(); } }
//Delete Accounts public void Delete(string id) { using (MSSQL400028Entities1 entities = new MSSQL400028Entities1()) { entities.Lec.Remove(entities.Lec.FirstOrDefault(e => e.Rid == id)); entities.SaveChanges(); } }
//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(); } }
//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(); } }
//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(); } }