public void RemoveByRoleId(int id) { var rolePrivileges = db.Set <RolePrivilege>().Where(x => x.RoleId == id); db.Set <RolePrivilege>().RemoveRange(rolePrivileges); db.SaveChanges(); }
public void RemoveByUserId(int id) { var userRoles = db.Set <UserRole>().Where(x => x.UserId == id); db.Set <UserRole>().RemoveRange(userRoles); db.SaveChanges(); }
public void Remove(RemovableTable removableTable) { db.Set <RemovableTable>().Remove(removableTable); db.SaveChanges(); }
public void ChangePassword(User user) { db.Set <User>().Attach(user); db.Entry(user).Property(x => x.Password).IsModified = true; db.SaveChanges(); }
public void Update(UpdatableTable updatableTable) { db.Set <UpdatableTable>().Update(updatableTable); db.SaveChanges(); }
public void Add(CreatableTable creatableTable) { db.Set <CreatableTable>().Add(creatableTable); db.SaveChanges(); }
public void AddRange(List <MultipleAddableTable> multipleAddableTables) { db.Set <MultipleAddableTable>().AddRange(multipleAddableTables); db.SaveChanges(); }
public void RemoveAll(List <MultipleRemovableTable> multipleRemovableTables) { db.Set <MultipleRemovableTable>().RemoveRange(multipleRemovableTables); db.SaveChanges(); }