public void update(department editItem) { department selectedItem = db.departments.SingleOrDefault(item => item.id == editItem.id); selectedItem.name = editItem.name; selectedItem.description = editItem.description; db.SaveChanges(); }
public void insert(department newItem) { db.departments.Add(newItem); db.SaveChanges(); }
public department selectSingle(department findItem) { department selectedItem = db.departments.SingleOrDefault(item => item.id == findItem.id); return selectedItem; }
public void delete(department deleteItem) { department selectedItem = db.departments.First(item => item.id == deleteItem.id); db.departments.Remove(selectedItem); db.SaveChanges(); }