コード例 #1
0
 //Delete Images
 public void Delete(int id)
 {
     using (MSSQL600021Entities entities = new MSSQL600021Entities())
     {
         entities.Images.Remove(entities.Images.FirstOrDefault(e => e.ID == id));
         entities.SaveChanges();
     }
 }
コード例 #2
0
 //Post Images
 public void Post([FromBody] Images imag)
 {
     using (MSSQL600021Entities entities = new MSSQL600021Entities())
     {
         entities.Images.Add(imag);
         entities.SaveChanges();
     }
 }
コード例 #3
0
        //Post Accounts

        public void Post([FromBody] Accounts accounts)
        {
            using (MSSQL600021Entities entities = new MSSQL600021Entities())
            {
                entities.Accounts.Add(accounts);
                entities.SaveChanges();
            }
        }
コード例 #4
0
        //Update Images (Put)
        public void Put(int id, [FromBody] Images img)
        {
            using (MSSQL600021Entities entities = new MSSQL600021Entities())
            {
                var entity = entities.Images.FirstOrDefault(e => e.ID == id);

                entity.ID   = img.ID;
                entity.Data = img.Data;
                entities.SaveChanges();
            }
        }
コード例 #5
0
        //Update Accounts (Put)
        public void Put(int id, [FromBody] Accounts accounts)
        {
            using (MSSQL600021Entities entities = new MSSQL600021Entities())
            {
                var entity = entities.Accounts.FirstOrDefault(e => e.ID == id);

                entity.Username = accounts.Username;
                entity.Password = accounts.Password;
                entity.Attached = accounts.Attached;


                entities.SaveChanges();
            }
        }