//Delete Images public void Delete(int id) { using (MSSQL600021Entities entities = new MSSQL600021Entities()) { entities.Images.Remove(entities.Images.FirstOrDefault(e => e.ID == id)); entities.SaveChanges(); } }
//Post Images public void Post([FromBody] Images imag) { using (MSSQL600021Entities entities = new MSSQL600021Entities()) { entities.Images.Add(imag); entities.SaveChanges(); } }
//Post Accounts public void Post([FromBody] Accounts accounts) { using (MSSQL600021Entities entities = new MSSQL600021Entities()) { entities.Accounts.Add(accounts); entities.SaveChanges(); } }
//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(); } }
//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(); } }