public void delete(int id) { ecomanagementContext = new EcoManagementEntities(); Whitelist whitelist = (from w in ecomanagementContext.Whitelists where w.ID == id select w).First(); whitelist.IsActive = false; ecomanagementContext.SaveChanges(); }
public void edit(int id, string reason, DateTime start, DateTime end, int createdBy, int workstationID) { ecomanagementContext = new EcoManagementEntities(); Whitelist whitelist = new Whitelist(); whitelist.ID = id; whitelist.Reason = reason; whitelist.Start = start; whitelist.End = end; whitelist.CreatedBy = createdBy; whitelist.IsActive = true; ecomanagementContext.Whitelists.AddObject(whitelist); ecomanagementContext.ObjectStateManager.ChangeObjectState(whitelist, System.Data.EntityState.Modified); ecomanagementContext.SaveChanges(); Workstation workstation = new Workstation(); workstation.editWhitelist(whitelist.ID, workstationID); }